大家好,又见面了,我是你们的朋友全栈君。
一个页面有多个导航栏跳转页面一定要有这三步
html 结构部分
<el-menu
:default-active="path"
class="el-menu-vertical-demo"
:unique-opened="true"
@select="listChange"
>
<el-menu-item index="/index/aiIdentify/achievementWall">
<i class="el-icon-document"></i>
<span slot="title">成果墙</span>
</el-menu-item>
<el-menu-item index="/index/aiIdentify/onlineAIRecognition">
<i class="el-icon-document"></i>
<span slot="title">在线AI识别</span>
</el-menu-item>
<el-menu-item index="/index/aiIdentify/identifyRecord">
<i class="el-icon-document"></i>
<span slot="title">识别记录</span>
</el-menu-item>
<el-menu-item index="/index/aiIdentify/resultsRecord">
<i class="el-icon-document"></i>
<span slot="title">成果记录</span>
</el-menu-item>
</el-menu>
data() {
return {
path: '/index/aiIdentify/achievementWall',
}
},
created() {
this.path = this.$route.path
},
watch: {
$route(e) {
this.path = e.path
},
},
methods: {
listChange(index, indexPath) {
this.path = index
if (this.$route.path !== this.path) {
this.$router.push(this.path)
}
},
}
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/139118.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...