rem

时间:2019-12-12 10:13:04   收藏:0   阅读:94

在vue的index.html中使用

<script>
    fnResize();
    window.onresize = function () {
      fnResize();
    }
    function fnResize() {
      var deviceWidth = document.documentElement.clientWidth || window.innerWidth;
      if (deviceWidth >= 750) {
        deviceWidth = 750;
      }
      if (deviceWidth <= 320) {
        deviceWidth = 320;
      }
      document.documentElement.style.fontSize = (deviceWidth / 7.5) + ‘px‘;
    }
  </script>

原文:https://www.cnblogs.com/xhrr/p/12027262.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!