Browse Source

优化初始加载代码

yhluo 6 months ago
parent
commit
08228abb77
2 changed files with 7 additions and 5 deletions
  1. 1 1
      src/utils/drawMixin.js
  2. 6 4
      src/views/assembly/index.vue

+ 1 - 1
src/utils/drawMixin.js

@@ -61,7 +61,7 @@ export default {
       }
       this.drawTiming = setTimeout(() => {
         this.calcRate()
-      }, 10000)
+      }, 1000)
     },
     fullScreen(){
       var docElm = document.documentElement; //若要全屏页面中div,var element= document.getElementById("divID");

+ 6 - 4
src/views/assembly/index.vue

@@ -159,7 +159,9 @@ export default {
   mounted() {
     this.timeFn()
     this.cancelLoading()
-    this.autoFullScreen()
+    this.$nextTick(()=>{
+      this.autoFullScreen()
+    })
     // 添加全屏状态变化监听
     document.addEventListener('fullscreenchange', this.handleFullScreenChange);
   },
@@ -209,11 +211,11 @@ export default {
     autoFullScreen() {
       // 如果已经全屏,则不再执行
       if (this.isFullScreen) return;
-
+      this.fullScreen();
       // 延迟3秒后自动全屏
-      setTimeout(() => {
+      /*setTimeout(() => {
         this.fullScreen();
-      }, 3000);
+      }, 3000);*/
     },
     handleBlur(val) {
       sessionStorage.setItem('li_code', val);