From 7055cd218913ebe1a637be77f0c10e9fde7981a0 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Wed, 5 Jun 2024 14:09:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(xpack):=20=E8=B7=AF=E7=94=B1=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/plugin/src/index.vue | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/core/core-frontend/src/components/plugin/src/index.vue b/core/core-frontend/src/components/plugin/src/index.vue index a22df5391c..fe3f091f28 100644 --- a/core/core-frontend/src/components/plugin/src/index.vue +++ b/core/core-frontend/src/components/plugin/src/index.vue @@ -94,17 +94,19 @@ onMounted(async () => { } else { distributed = wsCache.get(key) } + console.log('distributed', distributed, attrs, window['DEXPack']) + if (distributed) { - window['Vue'] = Vue - window['Axios'] = axios - window['Pinia'] = Pinia - window['vueRouter'] = vueRouter - window['MittAll'] = useEmitt().emitter.all - window['I18n'] = i18n if (window['DEXPack']) { const xpack = await window['DEXPack'].mapping[attrs.jsname] plugin.value = xpack.default } else { + window['Vue'] = Vue + window['Axios'] = axios + window['Pinia'] = Pinia + window['vueRouter'] = vueRouter + window['MittAll'] = useEmitt().emitter.all + window['I18n'] = i18n loadDistributed().then(async res => { new Function(res.data)() const xpack = await window['DEXPack'].mapping[attrs.jsname] @@ -116,16 +118,6 @@ onMounted(async () => { } }) -watch( - () => attrs.jsname, - () => { - if (window['DEXPack']) { - const xpack = window['DEXPack'].mapping[attrs.jsname] - plugin.value = xpack.default - } - } -) - const emits = defineEmits(['loadFail']) defineExpose({ invokeMethod @@ -134,7 +126,7 @@ defineExpose({