1. 使用 query传递参数
this.$router.push({
path:'/mvplay',
query:{
mvId:this.discList[index].vid,
}
})
this.$router.query.mvId
2.使用params传递参数时:需要在路由表中在path那里后面/:(参数名)
//传递参数
this.$router.push({
name: "mvplay",
params: {
//Mvid
mvId:this.discList[index].vid,
}
});
//接收参数
this.$route.params.mvId;
//路由表中的设置
{
name: 'mvplay',
path: '/mvplay/:mvId',
component: MvPlay
}