Quellcode durchsuchen

动态路由切换判断bug

panhui vor 4 Jahren
Ursprung
Commit
73dcb1153f
2 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  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']);