最近發現在部份機型上使用display: flex;會出現兼容性問題,經測試發現與prefix有關。
使用less時,建議加上autoprefix插件,步驟如下:
- 安裝插件
npm install less-plugin-autoprefix --save-dev
- 配置插件
在wepy.config.js中加入
const LessPluginAutoPrefix = require('less-plugin-autoprefix');
...
...
compilers: {
less: {
compress: true,
plugins: [new LessPluginAutoPrefix({browsers: ['Android >= 2.3', 'Chrome > 20', 'iOS >= 6']})]
}
官網https://github.com/Tencent/wepy/wiki/WePY-%E4%BD%BF%E7%94%A8less-autoprefix