From 2bac72eb5db86279b0e9348fb5438ec7af248074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com> Date: Tue, 10 Jan 2023 15:01:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DchartTabs=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=94=B1=E5=85=B6=E4=BB=96=E7=95=8C=E9=9D=A2=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E6=97=B6=E8=BF=98=E4=BF=9D=E7=95=99=E4=B8=8A=E6=AC=A1?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/ChartTabs.vue | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/components/common/ChartTabs.vue b/src/components/common/ChartTabs.vue index d0ce0d97..a7a11c72 100644 --- a/src/components/common/ChartTabs.vue +++ b/src/components/common/ChartTabs.vue @@ -230,6 +230,26 @@ export default { }, beforeUnmount () { clearTimeout(this.timer) + const path = this.$router.currentRoute.value.path + const list = window.currentChartTabList + if (list && this.router !== 'noRouter') { + if (list[1]) { + // 去其他界面,清除状态 + if (path !== list[0].path && path !== list[1].path) { + window.currentChartTabList = null + } else if (path === this.tabsData[0].path) { + // 场景为在本界面点击tabs,通过遮罩菜单栏又进入该界面,则初始化状态,默认选中第一个 + // 缺点:点击第一个tabs时没有过渡效果,后续会跟进解决 + window.currentChartTabList = [ + { path: list[1].path, index: list[1].index }, + { path: this.tabsData[0].path, index: '0' } + ] + } + } else if (path !== list[0].path) { + // 避免刷新页面之后又点击菜单栏进入该界面,还保留上次点击状态 + window.currentChartTabList = null + } + } } }