<script>
const WIDTH = 750
const setView = () => {
document.documentElement.style.fontSize = (100 * screen.width / WIDTH) + 'px'
}
window.onorientationchange = setView
setView()
</script>
直接用,WIDTH是设计稿宽度,单位直接用rem
<script>
const WIDTH = 750
const setView = () => {
document.documentElement.style.fontSize = (100 * screen.width / WIDTH) + 'px'
}
window.onorientationchange = setView
setView()
</script>
直接用,WIDTH是设计稿宽度,单位直接用rem