这里是跳转事件
this.$router.push({
path: '/aaa',
query: {
rightLabel: '这里是aaa',
labelId: 3,
}
});
这里是跳转到的页面,queryData需要先在data里定义
watch: {
// 利用watch方法检测路由变化:
$route: function (to, from) {
if (to.query.labelId !== from.query.labelId) { //如果传过来的页面id不一样
this.queryData = to.query // 获取参数 这里的queryData是我的路由参数
this.rightLabel = this.queryData.rightLabel //这里是页面展示的名称
this.labelId = this.queryData.labelId //页面传过来的id
}
}
},