12345678910111213141516171819202122232425262728293031323334353637383940 |
- <!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="<%= BASE_URL %>logo.png">
- <title><%= htmlWebpackPlugin.options.title %></title>
- <script>
- // 获取当前设备的宽度,设置rem的根字体大小
- let width = window.innerWidth
- width = width <= 1200 ? 1200 : width
- const htmlObj = document.getElementsByTagName('html')[0]
- htmlObj.style.fontSize = width / 56.47 + 'px'
-
- // 对resize事件进行浏览器兼容处理
- if(document.createEvent) {
- var event = document.createEvent("HTMLEvents");
- event.initEvent("resize", true, true);
- window.dispatchEvent(event);
- } else if(document.createEventObject) {
- window.fireEvent("onresize");
- }
-
- // 监听页面resize事件,重新设置rem的根字体大小
- window.onresize = function() {
- let width = window.innerWidth
- width = width <= 1200 ? 1200 : width
- htmlObj.style.fontSize = width / 56.47 + '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>
- </html>
|