Commit a0b5468189627a8b5d914d818b11c0bbd2af9148

Authored by panlinlin
1 parent 04f3511f

修复进入通道页面时导航显示异常

web_src/src/components/UiHeader.vue
1 <template> 1 <template>
2 <div id="UiHeader"> 2 <div id="UiHeader">
3 - <el-menu router :default-active="this.$route.path" menu-trigger="click" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" mode="horizontal"> 3 + <el-menu router :default-active="activeIndex" menu-trigger="click" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" mode="horizontal">
4 <el-menu-item index="/">控制台</el-menu-item> 4 <el-menu-item index="/">控制台</el-menu-item>
5 <el-menu-item index="/deviceList">设备列表</el-menu-item> 5 <el-menu-item index="/deviceList">设备列表</el-menu-item>
6 <el-menu-item index="/pushVideoList">推流列表</el-menu-item> 6 <el-menu-item index="/pushVideoList">推流列表</el-menu-item>
@@ -29,6 +29,7 @@ export default { @@ -29,6 +29,7 @@ export default {
29 return { 29 return {
30 alarmNotify: true, 30 alarmNotify: true,
31 sseSource: null, 31 sseSource: null,
  32 + activeIndex: this.$route.path,
32 }; 33 };
33 }, 34 },
34 methods:{ 35 methods:{
@@ -88,6 +89,11 @@ export default { @@ -88,6 +89,11 @@ export default {
88 } 89 }
89 } 90 }
90 }, 91 },
  92 + created(){
  93 + if (this.$route.path.startsWith("/channelList")){
  94 + this.activeIndex = "/deviceList"
  95 + }
  96 + },
91 mounted() { 97 mounted() {
92 window.addEventListener('beforeunload', e => this.beforeunloadHandler(e)) 98 window.addEventListener('beforeunload', e => this.beforeunloadHandler(e))
93 // window.addEventListener('unload', e => this.unloadHandler(e)) 99 // window.addEventListener('unload', e => this.unloadHandler(e))