index.html 1.4 KB
Newer Older
ylwdev's avatar
ylwdev 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="https://g.csdnimg.cn/static/logo/favicon32.ico">
    <title><%= htmlWebpackPlugin.options.title %></title>
    <script src="https://webapi.amap.com/maps?v=1.4.15&key=968f3f24decdc7564a37458565d50ad7&plugin=AMap.Scale,AMap.ToolBar"></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>
  <script>
    function isMobile () {
      var ua = window.navigator.userAgent
      if ( ua.match(/Android/i) || ua.match(/webOS/i) || ua.match(/SymbianOS/i) || ua.match(/iPhone/i) || ua.match(/iPad/i) || ua.match(/iPod/i) || ua.match(/BlackBerry/i) || ua.match(/Windows Phone/i) ) {
        return true
      } else {
        return false
      }
    }
    function setFontsize() {
      let vWidth = document.documentElement.clientWidth
      if (vWidth === 0) {
        setTimeout(function() {
          setFontsize();
        }, 100);
        return;
      }
      document.documentElement.style.fontSize = vWidth / 10 + 'px';
    }
    if(isMobile()) {
      setFontsize()
    }
  
  </script>
</html>