Ver código fonte

:recycle: checking route watch for same type

tags/0.9.0
J 4 anos atrás
pai
commit
78d77f2485
1 arquivos alterados com 9 adições e 11 exclusões
  1. 9
    11
      vue-theme/src/pages/list.vue

+ 9
- 11
vue-theme/src/pages/list.vue Ver arquivo

@@ -213,21 +213,19 @@ export default {
213 213
         type(newType, oldType) {
214 214
             if(!postTypes.includes(newType)) return console.warn('type not found...')
215 215
 
216
-            this.clearAndInitPostList('watcher')
216
+            this.clearAndInitPostList('type watcher')
217 217
         },
218 218
         // Only fire if the sort type has changed
219 219
         // and the post type is the same
220 220
         $route(to, from) {
221
-            const toPathSortBy = to.sortBy ? to.sortBy : to.fullPath
222
-                .split('/')
223
-                .filter(p => p)
224
-                .pop()
225
-            const fromPathSortBy = from.sortBy ? from.sortBy : from.fullPath
226
-                .split('/')
227
-                .filter(p => p)
228
-                .pop()
229
-            if(toPathSortBy != fromPathSortBy) {
230
-                this.clearAndInitPostList('watcher')
221
+            const findSortBy = route => {
222
+                return route.sortBy ? route.sortBy : route.fullPath
223
+                    .split('/')
224
+                    .filter(p => p)
225
+                    .pop()
226
+            }
227
+            if (findSortBy(to) != findSortBy(from) && typeFromRoute(to) == typeFromRoute(from)) {
228
+                this.clearAndInitPostList('$route watcher')
231 229
             } 
232 230
         }
233 231
     },

Carregando…
Cancelar
Salvar