From c1a6e450cc86e27d97a7c67cec3202a07e98b0e0 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Sat, 14 Sep 2024 17:12:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20xpack=E5=8A=A0=E8=BD=BD=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/plugin/src/index.vue | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/components/plugin/src/index.vue b/core/core-frontend/src/components/plugin/src/index.vue index 663eb2771a..3f0aeaae0d 100644 --- a/core/core-frontend/src/components/plugin/src/index.vue +++ b/core/core-frontend/src/components/plugin/src/index.vue @@ -102,7 +102,38 @@ const invokeMethod = param => { } onMounted(async () => { - loadComponent() + const key = 'xpack-model-distributed' + let distributed = false + if (wsCache.get(key) === null) { + const res = await xpackModelApi() + wsCache.set('xpack-model-distributed', res.data) + distributed = res.data + } else { + distributed = wsCache.get(key) + } + if (distributed) { + if (window['DEXPack']) { + const xpack = await window['DEXPack'].mapping[attrs.jsname] + plugin.value = xpack.default + } else if (!window._de_xpack_not_loaded) { + window._de_xpack_not_loaded = true + window['VueDe'] = Vue + window['AxiosDe'] = axios + window['PiniaDe'] = Pinia + window['vueRouterDe'] = router + window['MittAllDe'] = useEmitt().emitter.all + window['I18nDe'] = i18n + if (!window.tinymce) { + window.tinymce = tinymce + } + loadDistributed().then(async res => { + new Function(res.data)() + useEmitt().emitter.emit('load-xpack') + }) + } + } else { + loadComponent() + } }) const emits = defineEmits(['loadFail'])