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
即可讀取到傳遞過來的參數