const baseSize = 37.5
const setRem = () => {
const scale = document.documentElement.clientWidth / 375
document.documentElement.style.fontSize = (baseSize * Math.min(scale, 2)) + 'px'
}
// init
setRem()
window.onresize = function () {
setRem()
}
在main.js中引入即可
网友评论