Vue编程式路由跳转传递参数

2023-05-10,,

Vue 有时在路由跳转时需要用到一些原页面里的数据,用以下方法:

1、在跳转页的方法里写下query参数

TableChange(scope){
this.$router.push({
path:'details',
name:'details',
query:{ //需要携带的参数
projectId:this.projectId,
projectName:this.projectName,
linkMan:this.linkMan,
phone:this.phone,
address:this.address,
builders:this.builders
}
})
},

2、在目标页读取使用:

this.$route.query

即可读取到传递过来的参数

Vue编程式路由跳转传递参数的相关教程结束。

《Vue编程式路由跳转传递参数.doc》

下载本文的Word格式文档,以方便收藏与打印。