gaohaiyong 1 жил өмнө
parent
commit
14d4d8030b

+ 1 - 1
src/router/index.js

@@ -877,7 +877,7 @@ router.beforeEach(async (to, from, next) => {
     // 让 列表页 即不缓存,刷新
     to.meta.keepAlive = false; 
   }
-  if(to.path == '/allcase/index' ){
+  if(to.path == '/allcase/index' || to.path == '/encoder/index' ){
     to.meta.keepAlive = true; 
   }
   

+ 14 - 0
src/views/encoder/index.vue

@@ -505,6 +505,20 @@ export default {
     this.getDoctorRank();
     this.getFieldList();
   },
+  beforeRouteEnter(to, from, next) {
+
+    next(vm => {
+      // 回到原来的位置
+      const position = JSON.parse(window.sessionStorage.getItem('position'))
+      document.querySelector('.app-wrapper').scrollTop = position
+    })
+    },
+    beforeRouteLeave(to, from, next) {
+    // 保存离开页面时的位置
+    const position = document.querySelector('.app-wrapper').scrollTop
+    window.sessionStorage.setItem('position', JSON.stringify(position))
+    next()
+    },
   methods: {
     // 获取缺陷字段选项
     getFieldList() {