From 5889dd1009610ab471587056a3ca75e911779824 Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Mon, 31 Jul 2023 14:55:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=86=E5=9B=BE=E6=A0=B7=E5=BC=8F-?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=AF=BC=E8=87=B4=E4=BB=AA=E8=A1=A8=E6=9D=BF?= =?UTF-8?q?=E5=8F=91=E7=94=9F=E6=8A=96=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/chart/components/ChartComponent.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index 178daf6de0..627aa1c803 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -111,6 +111,7 @@ export default { data() { return { myChart: {}, + bodyOverflow: false, chartId: uuid.v1(), showTrackBar: true, trackBarStyle: { @@ -183,9 +184,13 @@ export default { }, mounted() { bus.$on('change-series-id', this.changeSeriesId) + document.querySelector('body').addEventListener('mouseover', this.bodyMouseover) + document.querySelector('body').addEventListener('mouseout', this.bodyMouseout) this.preDraw() }, beforeDestroy() { + document.querySelector('body').removeEventListener('mouseover', this.bodyMouseover) + document.querySelector('body').removeEventListener('mouseout', this.bodyMouseout) bus.$off('change-series-id', this.changeSeriesId) window.removeEventListener('resize', this.myChart.resize) this.myChart.dispose() @@ -195,6 +200,15 @@ export default { this.loadThemeStyle() }, methods: { + bodyMouseover() { + if (this.bodyOverflow) return + document.querySelector('body').style.overflow = 'hidden' + this.bodyOverflow = true + }, + bodyMouseout() { + document.querySelector('body').style.overflow = 'inherit' + this.bodyOverflow = false + }, scrollStatusChange() { if (this.haveScrollType.includes(this.chart.type)) { const opt = this.myChart.getOption() @@ -278,8 +292,6 @@ export default { this.myChart = this.$echarts.init(document.getElementById(this.chartId)) } this.drawEcharts() - - this.myChart.off('click') this.myChart.on('click', function(param) { that.pointParam = param if (that.linkageActiveParam) {