只限自己解决项目中遇到的问题
1.安装postcss-pxtorem(版本>=5.0.0)
npm install postcss postcss-pxtorem --save-dev
2.根文件夹创建postcss.config.js文件,同时适配设计稿
module.exports = {
plugins: {
// postcss-pxtorem 插件的版本需要 >= 5.0.0
'postcss-pxtorem': {
rootValue({ file }) {
return file.indexOf('vant') !== -1 ? 37.5 : 75;
},
propList: ['*'],
},
},
};
3.安装lib-flexible
npm i amfe-flexible
4.main.js导入该模块
import 'amfe-flexible'
4步配置就完成了vant组件在750设计稿中的缩小问题啦!