From c8921d86a1ae0418564a72f3fb192e54ce988ae2 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Wed, 17 Jul 2024 14:11:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(xpack):=20xpack=E5=8A=A0=E8=BD=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/plugin/src/index.vue | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/core/core-frontend/src/components/plugin/src/index.vue b/core/core-frontend/src/components/plugin/src/index.vue index 1aa2afdf6d..d412975937 100644 --- a/core/core-frontend/src/components/plugin/src/index.vue +++ b/core/core-frontend/src/components/plugin/src/index.vue @@ -49,6 +49,18 @@ const importProxy = (bytesArray: any[]) => { }) } +const loadXpack = async () => { + if (window['DEXPack']) { + const xpack = await window['DEXPack'].mapping[attrs.jsname] + plugin.value = xpack.default + } +} + +useEmitt({ + name: 'load-xpack', + callback: loadXpack +}) + const loadComponent = () => { loading.value = true const byteArray = wsCache.get(`de-plugin-proxy`) @@ -103,7 +115,8 @@ onMounted(async () => { if (window['DEXPack']) { const xpack = await window['DEXPack'].mapping[attrs.jsname] plugin.value = xpack.default - } else { + } else if (!window._de_xpack_not_loaded) { + window._de_xpack_not_loaded = true window['Vue'] = Vue window['Axios'] = axios window['Pinia'] = Pinia @@ -115,8 +128,7 @@ onMounted(async () => { } loadDistributed().then(async res => { new Function(res.data)() - const xpack = await window['DEXPack'].mapping[attrs.jsname] - plugin.value = xpack.default + useEmitt().emitter.emit('load-xpack') }) } } else {