vue watch route params change
watch: {
'$route.params.menuKey' (val, oldVal) {
console.log('new route ', val);
// this.currentTab = val;
},
},
watch: {
'$route.params.search': {
handler: function(search) {
console.log(search)
},
deep: true,
immediate: true,
}
}
watch:{
'$route' (to, from){
// Put your logic here...
}
},
this.$forceUpdate()
vm.$forceUpdate()
vm.$nextTick( [callback] )
https://vuejs.org/v2/api/#vm-forceUpdate
https://vuejs.org/v2/api/#vm-nextTick
refs
https://stackoverflow.com/questions/50981059/watch-route-object-on-vue-js/50981093
https://router.vuejs.org/guide/essentials/dynamic-matching.html
https://forum.vuejs.org/t/rerendering-component-on-route-param-change-recalling-created-hooks/9536
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!