在src目录下建立 viewport.jscss
文件下载:https://github.com/imochen/hotcss/tree/master/srcvue
这个JS是用来在页面打开的时候给HTML根加上适配的字体大小git
而后在main.js下添加:github
而后在 vue.config.js加入:npm
module.exports = {
lintOnSave: false,//关闭eslint
css: {
loaderOptions: {
postcss: {
plugins: [
require('postcss-px2rem')({remUnit: 75}), // 换算的基数
]
}
}
}
}post
最后重启字体
内容参考:https://blog.csdn.net/u010214074/article/details/84841496flex