功能:实现点击页面A的“更多”,跳转到页面B的“重大消息”
先看一下el-tabs的代码
<div class="tabs">
<el-tabs v-model="activeName" @tab-click="changeTab">
<el-tab-pane label="系统推送" name="receivedAutoNotice"></el-tab-pane>
<el-tab-pane label="管理员通知" name="receivedNotice"></el-tab-pane>
<el-tab-pane label="重大通知" name="receivedAnnounce"></el-tab-pane>
</el-tabs>
</div>
data(){
return{
currentTab:'receivedAutoNotice',//默认选择系统推送
activeName:'receivedAutoNotice',
}
}
首先,在页面A跳转路由时将activeName和currentTab带上。
this.$router.push({path:'/notify?activeName=receivedAnnounce¤tTab=receivedAnnounce'});
然后注意在页面B接收:
mounted(){
this.showface();
},
method:{
showface(){
if(this.$route.query.activeName!=null){
this.activeName = this.$route.query.activeName;
this.currentTab = this.$route.query.currentTab;
var current1 = this.currentTab;
this.loading = true;
if(current1=='receivedAnnounce'){
this.gerAnnounceList() //这里写一些跳转后必须要执行的函数
}
}
},
}