Browse Source

H5:点单记录列表、订座记录列表滚动位置记录

panyong 3 years ago
parent
commit
175e62563f

+ 7 - 1
htmldev/dashboard/src/views/order/list/index.vue

@@ -82,7 +82,12 @@ export default {
       this.pagenum = 0
       this.pagesize = 20
       this.list = []
-    } else {}
+    } else {
+      setTimeout(() => {
+        const numScrollTop = this.$route.meta.numScrollTop || 0
+        window.scrollTo(0, numScrollTop)
+      }, 500)
+    }
     this.$route.meta.isUseCache = false
   },
   methods: {
@@ -171,6 +176,7 @@ export default {
   beforeRouteLeave (to, form, next) {
     if (['Mine', 'OrderDetail'].findIndex(item => item === to.name) > -1) {
       form.meta.isUseCache = true
+      form.meta.numScrollTop = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset
     }
     next()
   }

+ 6 - 0
htmldev/dashboard/src/views/place/reserve/index.vue

@@ -93,6 +93,11 @@ export default {
       this.pagenum = 0
       this.pagesize = 20
       this.booLock = false
+    } else {
+      setTimeout(() => {
+        const numScrollTop = this.$route.meta.numScrollTop || 0
+        window.scrollTo(0, numScrollTop)
+      }, 500)
     }
     this.$route.meta.isUseCache = false
   },
@@ -191,6 +196,7 @@ export default {
   beforeRouteLeave (to, form, next) {
     if (['Mine', 'PlaceCheck'].findIndex(item => item === to.name) > -1) {
       form.meta.isUseCache = true
+      form.meta.numScrollTop = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset
     }
     next()
   }