问题:
从A页面携带参数跳转到B页面,首次跳转可以正常接收到,第二次传的参数无效,实际上已经传了,但是没有被监听到
解决:
页面A(页面跳转)
handleClick(row){
this.$router.push({
name:'路由名称',
path:'路由路径',
//也使用params,
//query会在地址栏上显示传递的参数,params则不会
//使用params必须加上路由的name
query:{
key1:value1,
key2:value2
}
})
}
页面B(页面接收)
watch:{
$router(){
this.listQuery.data1 = this.$router.query.value1
this.listQuery.data2 = this.$router.query.value2
//监听到对象后调用请求方法
this.getList()
}
}