Open buptsb opened 5 years ago
In file src/entry-client.js, we have beforeRouteUpdate mixin:
src/entry-client.js
beforeRouteUpdate
Vue.mixin({ beforeRouteUpdate (to, from, next) { const { asyncData } = this.$options if (asyncData) { asyncData({ store: this.$store, route: to }).then(next).catch(next) } else { next() } } })
And in src/views/ItemList.vue, we have been watching for vue-router's page:
src/views/ItemList.vue
watch: { page (to, from) { this.loadItems(to, from) } },
And I thought these two code fragments are doing the same thing, is it just for demonstrating or other purposes? Thanks!
In file
src/entry-client.js
, we havebeforeRouteUpdate
mixin:And in
src/views/ItemList.vue
, we have been watching for vue-router's page:And I thought these two code fragments are doing the same thing, is it just for demonstrating or other purposes? Thanks!