|
|
@@ -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
|
},
|