index.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <!DOCTYPE html>
  2. <html lang="">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width,initial-scale=1.0" />
  7. <link rel="icon" href="<%= BASE_URL %>logo.png" />
  8. <title><%= htmlWebpackPlugin.options.title %></title>
  9. <script src="http://static.harbinxiaoshi.cn/static/js/ezuikit.js"></script>
  10. <script>
  11. // 获取当前设备的宽度,设置rem的根字体大小
  12. let width = window.innerWidth
  13. width = width <= 1200 ? 1200 : width
  14. const htmlObj = document.getElementsByTagName('html')[0]
  15. htmlObj.style.fontSize = width / 56.47 + 'px'
  16. // 对resize事件进行浏览器兼容处理
  17. if (document.createEvent) {
  18. var event = document.createEvent('HTMLEvents')
  19. event.initEvent('resize', true, true)
  20. window.dispatchEvent(event)
  21. } else if (document.createEventObject) {
  22. window.fireEvent('onresize')
  23. }
  24. // 监听页面resize事件,重新设置rem的根字体大小
  25. window.onresize = function () {
  26. let width = window.innerWidth
  27. width = width <= 1200 ? 1200 : width
  28. htmlObj.style.fontSize = width / 56.47 + 'px'
  29. }
  30. </script>
  31. </head>
  32. <body>
  33. <noscript>
  34. <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
  35. </noscript>
  36. <div id="app"></div>
  37. <!-- built files will be auto injected -->
  38. </body>
  39. </html>