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

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

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

原文地址:https://www.cnblogs.com/bomdeyada/p/10217551.html