在根文件中添加
<script> (function(w,d) { function setSize() { var screenWidth = d.documentElement.clientWidth; var currentFontSize = screenWidth * 100 / 750; d.documentElement.style.fontSize = currentFontSize + 'px'; } w.addEventListener('resize',setSize); w.addEventListener('pageShow',setSize) w.addEventListener('DOMContentLoaded',setSize) })(window,document) </script>
标签:function,动态,rem,currentFontSize,计算,addEventListener,var,screenWidth,setSize From: https://www.cnblogs.com/shanhetoyi/p/16802202.html