Vueでthis.$router.Pushパラメータの方法はどれらがあります
1.paramsパス:
ルーティングダイナミックパラメータ:
2.queryパス:
まとめ:
queryパラメータはurlの後ろにアドレスバー(/page 2?sellerId=xx&code=xxx&payTool=xxx)に表示されます.
paramsパラメータはアドレスバーに表示されません
var id = this.tableDate[index].id;
this.$router.push({name:'testResult',params:{id:id}});
//
let id = this.$route.params.id
ルーティングダイナミックパラメータ:
//
{
path: '/pay/:sellerId',
component: alliance,
meta: { title: ' ',wechat_auth: true, alipay_auth: true }
}
//
this.sellerId = this.$route.params.sellerId;
2.queryパス:
// 、
this.$router.push({
path:'/testResult',
query:{
sellerId: sellerId,
code: code,
payTool: payTool,
allianceData: this.allianceData //
}
});
//
this.sellerId= this.$route.query.sellerId;
this.code= this.$route.query.code;
this.payTool= this.$route.query.payTool;
this.allianceData = this.$route.query.allianceData;
まとめ:
queryパラメータはurlの後ろにアドレスバー(/page 2?sellerId=xx&code=xxx&payTool=xxx)に表示されます.
paramsパラメータはアドレスバーに表示されません