vue3 pc端1920*1080 pxtorem 适配 1.安装依赖
npm install amfe-flexible --save
npm install postcss-pxtorem --save
2.在入口文件main.js中导入amfe-flexible
import 'amfe-flexible';
3.在vue.config.js创建postcss.config.js文件
module.exports = {
plugins: {
autoprefixer: {
overrideBrowserslist: [
"Android 4.1",
"iOS 7.1",
"Chrome > 31",
"ff > 31",
"ie >= 8",
"last 10 versions", // 所有主流浏览器最近10版本用
],
grid: true,
},
'postcss-pxtorem': {
rootValue: 192,
propList: ['*'],
unitPrecision: 10
}
}
}