Merge pull request #10999 from dataease/pr@dev-v2_st

fix(xpack): xpack加载优化
This commit is contained in:
dataeaseShu 2024-07-17 14:12:50 +08:00 committed by GitHub
commit 45eeac0e4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 {