panhui 4 лет назад
Родитель
Сommit
73dcb1153f
2 измененных файлов с 2 добавлено и 2 удалено
  1. 1 1
      src/views/product/List.vue
  2. 1 1
      src/views/product/Search.vue

+ 1 - 1
src/views/product/List.vue

@@ -288,7 +288,7 @@ export default {
         });
     },
     beforeRouteLeave(to, from, next) {
-        if (to.path === '/productDetail') {
+        if (to.name === 'productDetail') {
             this.beforeSort = this.sort;
             this.scrollTop = this.scrollWrapper.value.scrollTop;
             this.setKeeps(['productList']);

+ 1 - 1
src/views/product/Search.vue

@@ -244,7 +244,7 @@ export default {
         });
     },
     beforeRouteLeave(to, from, next) {
-        if (to.path === '/productDetail') {
+        if (to.name === 'productDetail') {
             this.beforeSort = this.sort;
             this.scrollTop = this.scrollWrapper.value.scrollTop;
             this.setKeeps(['productSearch']);