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() } } }