vue-cli3 PC端适配
1、首先安装两个插件:postcss-px2rem,amfe-flexible
npm i postcss-px2rem -S
npm i amfe-flexible -S
2、配置postcss-px2rem,跟 package.json 同级 创建一个文件 .postcssrc.js
module.exports = {
plugins: {
autoprefixer: {},
'postcss-px2rem': {
remUnit: 192 // PC端(1920的UI图)
//remUnit: 75 // 移动端(750的UI图)
}
}
}
3、然后在 main.js 中引入 amfe-flexible
import 'amfe-flexible'