浏览代码

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.$msgCenter = new MessageCenter()
 
-const idealWindowInnerWidth = 2436 // 设计稿的宽度
+const idealWindowInnerWidth = 1125 // 设计稿的宽度
 const idealRootFontSize = 24 // 设计稿里选择的根元素尺寸
-Vue.prototype.$oneRemToPx = window.innerHeight * idealRootFontSize / idealWindowInnerWidth
 
 function onResize() {
+  Vue.prototype.$oneRemToPx = window.innerWidth * idealRootFontSize / idealWindowInnerWidth
   document.documentElement.style.fontSize = Vue.prototype.$oneRemToPx + 'px'
 }
 onResize()