Browse Source

试卷编辑后恢复滚动条位置

Michael Wang 5 years ago
parent
commit
74b5cefad9
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/modules/questions/views/EditPaper.vue

+ 6 - 0
src/modules/questions/views/EditPaper.vue

@@ -876,6 +876,8 @@ export default {
     },
     },
     //初始化试卷
     //初始化试卷
     initPaper() {
     initPaper() {
+      const scrollPosition =
+        document.documentElement.scrollTop || document.body.scrollTop;
       this.loading = true;
       this.loading = true;
       this.paper = {
       this.paper = {
         course: {
         course: {
@@ -922,6 +924,10 @@ export default {
             }
             }
           }
           }
         }
         }
+        setTimeout(() => {
+          document.documentElement.scrollTop = document.body.scrollTop = scrollPosition;
+          console.log(scrollPosition);
+        }, 1000);
         this.loading = false;
         this.loading = false;
       });
       });
     },
     },