-
- automatedPresentation.vue
-
+
+
+
-
From 43decc46c77a569d2ccc5e2c0f5c3b51489a3115 Mon Sep 17 00:00:00 2001
From: lizw-2015 <1183409807@qq.com>
Date: Wed, 9 Jul 2025 14:33:37 +0800
Subject: [PATCH 2/2] =?UTF-8?q?feat(editor):=20=E6=B7=BB=E5=8A=A0=E7=AA=97?=
=?UTF-8?q?=E5=8F=A3=E6=B6=88=E6=81=AF=E7=9B=91=E5=90=AC=E5=99=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在 ModelMain 组件中添加了 window message 事件监听器
- 监听函数为 this.mes,用于处理接收到的消息
- 在组件卸载时移除消息监听器,避免内存泄漏
---
src/editor/ModelMain.vue | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/editor/ModelMain.vue b/src/editor/ModelMain.vue
index 3033520..419115e 100644
--- a/src/editor/ModelMain.vue
+++ b/src/editor/ModelMain.vue
@@ -175,9 +175,12 @@ export default {
}
this.editorHash += 1 // 刷新编辑器
})
+
+ window.addEventListener('message', this.mes)
},
unmounted() {
ModelMainUnmounted()
+ window.removeEventListener('message', this.mes)
},
data() {
return {
@@ -253,6 +256,9 @@ export default {
methods: {
renderIcon,
getWidgetBySide,
+ mes(event) {
+ console.log('data', event.data);
+ },
toHome() {
system.router.push({ name: 'home' })
},