From 2bcc4a7c18b9c3c8b013c327905ac498ed4c8263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Wed, 28 Aug 2024 16:39:35 +0800 Subject: [PATCH] =?UTF-8?q?Demo=EF=BC=9A=E6=94=AF=E6=8C=81=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E7=94=BB=E5=B8=83=E5=8F=96=E6=B6=88=E7=BC=A9=E6=94=BE?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E7=9A=84=E8=81=9A=E7=84=A6=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/Edit/components/Scale.vue | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/web/src/pages/Edit/components/Scale.vue b/web/src/pages/Edit/components/Scale.vue index 70002582..0bb0f03d 100644 --- a/web/src/pages/Edit/components/Scale.vue +++ b/web/src/pages/Edit/components/Scale.vue @@ -10,6 +10,7 @@
{ - this.scaleNum = this.toPer(scale) - }) + this.mindMap.on('scale', this.onScale) + this.mindMap.on('draw_click', this.onDrawClick) this.scaleNum = this.toPer(this.mindMap.view.scale) } } }, + beforeDestroy() { + this.mindMap.off('scale', this.onScale) + this.mindMap.off('draw_click', this.onDrawClick) + }, methods: { // 转换成百分数 toPer(scale) { @@ -98,6 +102,14 @@ export default { const cy = this.mindMap.height / 2 this.mindMap.view.setScale(this.scaleNum / 100, cx, cy) } + }, + + onScale(scale) { + this.scaleNum = this.toPer(scale) + }, + + onDrawClick() { + if (this.$refs.inputRef) this.$refs.inputRef.blur() } } }