vue根据进入的路由进行原路返回的方法
情景:
a---------->c 点击返回,希望返回到a
b---------->c 点击返回,希望返回到b
解决方案:
前端精品教程:百度网盘下载
a页面,加from字段
|
1
2
3
4
5
6
7
8
9
10
11
12
|
PubSub.subscribe('table-view', function(msg, args) { var rowData = args[0], rowIndex = args[1]; //跳转详情页 this.$router.push({ name: 'viewAdvertiseDetails', query: { id: this.$route.query.id, adsenseCampaignId: rowData.id, from: 'viewAdvertise', }, })}.bind(this)); |
b页面,加from字段
前端精品教程:百度网盘下载
|
1
2
3
4
5
6
7
8
9
10
11
|
PubSub.subscribe('table-view', function(msg, args) { var rowData = args[0], rowIndex = args[1]; this.$router.push({ name: 'viewAdvertiseDetails', query: { id: this.$route.query.id, adsenseCampaignId: rowData.id, from: 'setAdvertise', }, })}.bind(this)); |
c页面:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
back: function() { if(this.$route.query.from==='viewAdvertise'){ this.$router.push({ name: 'viewAdvertise', query: { id: this.$route.query.id }, }) }else if(this.$route.query.from==='setAdvertise'){ this.$router.push({ name: 'setAdvertise', query: { id: this.$route.query.id }, }) }} |
浙公网安备 33010602011771号