From a0b5468189627a8b5d914d818b11c0bbd2af9148 Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: 星期三, 28 四月 2021 18:24:00 +0800 Subject: [PATCH] 修复进入通道页面时导航显示异常 --- web_src/src/components/UiHeader.vue | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/web_src/src/components/UiHeader.vue b/web_src/src/components/UiHeader.vue index e537953..f1b0e1d 100644 --- a/web_src/src/components/UiHeader.vue +++ b/web_src/src/components/UiHeader.vue @@ -1,6 +1,6 @@ <template> <div id="UiHeader"> - <el-menu router :default-active="this.$route.path" menu-trigger="click" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" mode="horizontal"> + <el-menu router :default-active="activeIndex" menu-trigger="click" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" mode="horizontal"> <el-menu-item index="/">鎺у埗鍙�</el-menu-item> <el-menu-item index="/deviceList">璁惧鍒楄〃</el-menu-item> <el-menu-item index="/pushVideoList">鎺ㄦ祦鍒楄〃</el-menu-item> @@ -29,6 +29,7 @@ return { alarmNotify: true, sseSource: null, + activeIndex: this.$route.path, }; }, methods:{ @@ -59,8 +60,8 @@ sseControl() { let that = this; if (this.alarmNotify) { - console.log("鐢宠SSE鎺ㄩ�丄PI璋冪敤锛屾祻瑙堝櫒ID: " + this.$browserId); - this.sseSource = new EventSource('/api/emit?browserId=' + this.$browserId); + console.log("鐢宠SSE鎺ㄩ�丄PI璋冪敤锛屾祻瑙堝櫒ID: " + this.$browserId); + this.sseSource = new EventSource('/api/emit?browserId=' + this.$browserId); this.sseSource.addEventListener('message', function(evt) { that.$notify({ title: '鏀跺埌鎶ヨ淇℃伅', @@ -88,6 +89,11 @@ } } }, + created(){ + if (this.$route.path.startsWith("/channelList")){ + this.activeIndex = "/deviceList" + } + }, mounted() { window.addEventListener('beforeunload', e => this.beforeunloadHandler(e)) // window.addEventListener('unload', e => this.unloadHandler(e)) -- Gitblit v1.8.0