Vue (第6篇教程 从一个页面跳转并且传参到另一个页面)
本文跳转传参用的是:this.$router.push1、首先定义好要跳转的页面(跳转到MonitoringDetails)以及传递的参数(benid2就是要传递的参数)。goMonitoringDetails() {this.$router.push({name: "MonitoringDetails",//跳转的页面p...
·
本文跳转传参用的是:this.$router.push
1、首先定义好要跳转的页面(跳转到MonitoringDetails)以及传递的参数(benid2就是要传递的参数)。
goMonitoringDetails() {
this.$router.push({
name: "MonitoringDetails", //跳转的页面
params:{
"benid2":this.currentData.benid2 //我们要传递的参数
}
});
}
2、在另一个页面(MonitoringDetails)接收。
getParams(){
var routerParams = this.$route.params.benid2;
// 将数据放在当前组件的数据内
this.id = routerParams;
console.log("我们接收的参数为:"+this.id)
},
更多推荐
已为社区贡献8条内容
所有评论(0)