From b79076baa3858c78247a15dc7ee7ee87e281b1e8 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Sun, 13 Apr 2025 13:41:09 +0800 Subject: [PATCH] =?UTF-8?q?Feat:=E6=BC=94=E7=A4=BA=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=90=8C=E6=AD=A5=E6=80=9D=E7=BB=B4=E5=AF=BC?= =?UTF-8?q?=E5=9B=BE=E7=9A=84=E9=80=89=E9=A1=B9=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/Demonstrate.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/simple-mind-map/src/plugins/Demonstrate.js b/simple-mind-map/src/plugins/Demonstrate.js index 7d557d77..714a0f28 100644 --- a/simple-mind-map/src/plugins/Demonstrate.js +++ b/simple-mind-map/src/plugins/Demonstrate.js @@ -43,6 +43,18 @@ class Demonstrate { this.mindMap.opt.demonstrateConfig || {} ) this.needRestorePerformanceMode = false + this.onConfigUpdate = this.onConfigUpdate.bind(this) + this.mindMap.on('after_update_config', this.onConfigUpdate) + } + + // 监听配置更新 + onConfigUpdate(opt) { + if (typeof opt.demonstrateConfig !== 'undefined') { + this.config = { + ...this.config, + ...opt.demonstrateConfig + } + } } // 进入演示模式 @@ -417,11 +429,13 @@ class Demonstrate { // 插件被移除前做的事情 beforePluginRemove() { this.unBindEvent() + this.mindMap.off('after_update_config', this.onConfigUpdate) } // 插件被卸载前做的事情 beforePluginDestroy() { this.unBindEvent() + this.mindMap.off('after_update_config', this.onConfigUpdate) } }