gaoxizhong 1 жил өмнө
parent
commit
e347102b69

+ 4 - 0
src/router/index.js

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

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

@@ -141,6 +141,20 @@ export default {
     this.funQuery();
     this.selectInfo();
   },
+  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: {
     // 获取部门集合
     getDepartmentList() {