"postcss": {
"plugins": {
"autoprefixer": {},
"postcss-px2rem-exclude": {
"remUnit": 37.5,
"exclude": "/node_modules/i"
}
}
},
复制代码
window.onresize = setHtmlFontSize
window.onload = setHtmlFontSize
function setHtmlFontSize() {
const htmlWidth = document.documentElement.clientWidth || document.body.clinentWidth;
const htmlDom = document.documentElement;
htmlDom.style.fontSize = htmlWidth / 10 + "px"
}
setHtmlFontSize()
复制代码
import "@/common/js/resetFont.js"
复制代码
这样咱们在vue-cli3项目中就可使用rem布局,且单位是px的单位css