js 文件
window.addEventListener("onorientationchange",setrem)
window.addEventListener("resize",setrem)
setrem()
function setrem(){
var html = document.querySelector("html")
var width = html.getBoundingClientRect().width
html.style.fontSize = width/16+"px"
}
scss 文件
@function rem($px){
@return $px /46.875 +rem
}
css
调用rem
rem(px)