Преглед изворни кода

bug fix: 样式没有随宽度而变

任一存 пре 2 година
родитељ
комит
841560552f
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      src/main.js

+ 2 - 2
src/main.js

@@ -36,11 +36,11 @@ Vue.prototype.$globalConfig = globalConfig
 Vue.prototype.$cdnPath = process.env.VUE_APP_CDN_PATH
 Vue.prototype.$cdnPath = process.env.VUE_APP_CDN_PATH
 Vue.prototype.$msgCenter = new MessageCenter()
 Vue.prototype.$msgCenter = new MessageCenter()
 
 
-const idealWindowInnerWidth = 2436 // 设计稿的宽度
+const idealWindowInnerWidth = 1125 // 设计稿的宽度
 const idealRootFontSize = 24 // 设计稿里选择的根元素尺寸
 const idealRootFontSize = 24 // 设计稿里选择的根元素尺寸
-Vue.prototype.$oneRemToPx = window.innerHeight * idealRootFontSize / idealWindowInnerWidth
 
 
 function onResize() {
 function onResize() {
+  Vue.prototype.$oneRemToPx = window.innerWidth * idealRootFontSize / idealWindowInnerWidth
   document.documentElement.style.fontSize = Vue.prototype.$oneRemToPx + 'px'
   document.documentElement.style.fontSize = Vue.prototype.$oneRemToPx + 'px'
 }
 }
 onResize()
 onResize()