美文网首页
vue的设置根元素字体大小

vue的设置根元素字体大小

作者: 最念倾城 | 来源:发表于2020-04-26 12:36 被阅读0次
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1,initial-scale=1.0,user-scalable=no">
        <link rel="icon" href="<%= BASE_URL %>favicon.ico">
        <title><%= htmlWebpackPlugin.options.title %></title>
        <script>
          //设置根元素字体大小
          document.documentElement.style.fontSize = document.documentElement.clientWidth/10 + 'px'
          console.log (document.documentElement.style.fontSize)
          // 监听 屏幕大小的改变
          window.addEventListener('resize',()=>{
            document.documentElement.style.fontSize = document.documentElement.clientWidth/10 + 'px'
          })
        </script>
      </head>
      <body>
        <noscript>
          <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
        </noscript>
        <div id="app"></div>
        <!-- built files will be auto injected -->
      </body>
    
    maximum-scale=1,initial-scale=1.0,user-scalable=no"
    这一段代码是禁止屏幕缩放
    

    相关文章

      网友评论

          本文标题:vue的设置根元素字体大小

          本文链接:https://www.haomeiwen.com/subject/heudwhtx.html