amfe-flexible 自动根据移动端的屏幕大小而动态改变字体大小
npm 下载后在main.js引入
import ‘amfe-flexible’ //移动端rem适配
postcss-pxtorem 自动将我们本地的css文件里的px单位转换成rem,在根目录.postcssrc.js文件里进行配置`
module.exports = {
plugins: {
//...
'autoprefixer': {
browsers: ['Android >= 4.0', 'iOS >= 7']
},
'postcss-pxtorem': {
rootValue: 37.5, //css里的px单位按照37.5这个值进行转换,0.1rem就是3.75px
propList: ['*']
}
}
}