From 79a1f96fe622f22f61b7f0f1dca671611583c0f4 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Thu, 10 Apr 2025 12:10:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E5=BC=B9=E7=AA=97=E4=BC=98=E5=8C=96=EF=BC=8C?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E8=8F=9C=E5=8D=95=E6=98=BE=E7=A4=BA=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E6=97=B6=EF=BC=8C=E4=BB=85=E6=93=8D=E4=BD=9C=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E7=9A=84tooltip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/visualization/ViewTrackBar.vue | 23 ++++++++----------- .../indicator/DeIndicator.vue | 2 +- .../views/components/ChartComponentG2Plot.vue | 2 +- .../views/components/ChartComponentS2.vue | 2 +- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/core/core-frontend/src/components/visualization/ViewTrackBar.vue b/core/core-frontend/src/components/visualization/ViewTrackBar.vue index 50793c08f5..85722f2827 100644 --- a/core/core-frontend/src/components/visualization/ViewTrackBar.vue +++ b/core/core-frontend/src/components/visualization/ViewTrackBar.vue @@ -56,21 +56,16 @@ const state = reactive({ } }) const visibleChange = isVisible => { - const tooltips = document.querySelectorAll('.g2-tooltip') - if (tooltips) { - tooltips.forEach(tooltip => { - if (isVisible) { - // 当下拉菜单显示时,添加隐藏样式 - tooltip.classList.add('hidden-tooltip') - } else { - // 当下拉菜单隐藏时,移除隐藏样式 - tooltip.classList.remove('hidden-tooltip') - } - }) - } + document.querySelectorAll('.g2-tooltip')?.forEach(tooltip => { + if (tooltip.id?.includes(chartId.value)) { + tooltip.classList.toggle('hidden-tooltip', isVisible) + } + }) } - -const trackButtonClick = () => { +// 添加图表标识,用于区分不同图表的 tooltip +const chartId = ref(null) +const trackButtonClick = (id?: string) => { + chartId.value = id setTimeout(() => { trackButton.value.click() }, 50) diff --git a/core/core-frontend/src/custom-component/indicator/DeIndicator.vue b/core/core-frontend/src/custom-component/indicator/DeIndicator.vue index 8afd5f59df..71b68868fc 100644 --- a/core/core-frontend/src/custom-component/indicator/DeIndicator.vue +++ b/core/core-frontend/src/custom-component/indicator/DeIndicator.vue @@ -515,7 +515,7 @@ const action = param => { state.trackBarStyle.top = barStyleTemp.top + 'px' } - viewTrack.value.trackButtonClick() + viewTrack.value.trackButtonClick(view.value.id) } } diff --git a/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue b/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue index c46a6ea329..ec05554f75 100644 --- a/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue +++ b/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue @@ -494,7 +494,7 @@ const action = param => { state.trackBarStyle.top = trackBarY + 'px' } - viewTrack.value.trackButtonClick() + viewTrack.value.trackButtonClick(view.value.id) } } diff --git a/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue b/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue index e66cb4bc59..d0cd061829 100644 --- a/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue +++ b/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue @@ -402,7 +402,7 @@ const action = param => { state.trackBarStyle.top = barStyleTemp.top + 'px' } - viewTrack.value.trackButtonClick() + viewTrack.value.trackButtonClick(view.value.id) } } const appStore = useAppStoreWithOut()