由于剛學習vue,很多地方在官網上面看的不是很明白現有這樣一個需求:當點擊button時,跳轉到另一個頁面,另一個頁面內容為上個頁面的數據詳細信息
當前頁面已經獲取到數據,想把數據傳到另一個頁面
請問如何通過路由跳轉的方式來進行頁面之間的相互傳值
planDetail(personid, plan, relation, productProperty) {
let param = {
personId: personid,
productCode: plan
};
console.log("入參", param); this.$http.postBody("/1/111", param, result => {
console.log(result); this.productDetail = result.body.rows; if (relation == "1") { this.detailTitle =
productProperty == "1" ? "都市客從" : "方法 " + "吃的是草";
} else { this.detailTitle =
productProperty == "1" ? "的是" : "的的" + "的方式vs";
} this.familyShow = true; this.$router.push({name: 'employeeplan', query:param})
});
2 回答

動漫人物
TA貢獻1815條經驗 獲得超10個贊
PolarisJack說的沒錯。
/* 父組件 */ /** * 在index.js中的router注冊后 * { * path: '/....', * name: 'aaa', * component: AAA * } */ this.$router.push({ name: 'aaa', params: { nameYouWant: name1, nameYouWant2: name2 } }) /* 子組件 */ // 子組件此處是$route, 沒有r, 此處輸出name1 let thingsWeGet = this.$route.params.nameYouWant
添加回答
舉報
0/150
提交
取消