url相同、参数不同。强制跳转刷新
跳转方法
wlb(){
this.$router.push({
path: '/zxxx/index',
query: { index: '1' }
})
},
wkc(){
this.$router.push({
path: '/zxxx/index',
query: { index: '0'}
})
},
当在path为'/zxxx/index'页面,点击wlb()、wkc() 方法时是不走vue生命周期函数的。需要监听$route变化。
'$route'(to, from) {
let { index } = to.query;
this.activeName = index === '1' ? 'second' : 'first'
this.handleClick({index: index})
}