"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