使用pxtorem px转成rem
- yarn add lib-flexible
- 在main.js引入中:import ‘lib-flexible/flexible.js’
- yarn add postcss-pxtorem
-
- 在vue.config.js里面.
module.exports = {
lintOnSave: false,
devServer: {
port: 7777,
host: 'localhost',
https: false,
open: true
},
css:{
loaderOptions: {
postcss: {
plugins: [
require('postcss-pxtorem')({
rootValue : 37.5, // 换算的基数
propList : ['*'],
}),
]
}
}
}
}
怕自己忘记了步骤先记下了, 目前更改了一部分, 不知道引入element-ui后会不会有问题