forked from github/dataease
fix(xpack): 路由切换异常
This commit is contained in:
parent
67b283e737
commit
7055cd2189
@ -94,17 +94,19 @@ onMounted(async () => {
|
||||
} else {
|
||||
distributed = wsCache.get(key)
|
||||
}
|
||||
console.log('distributed', distributed, attrs, window['DEXPack'])
|
||||
|
||||
if (distributed) {
|
||||
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
|
||||
if (window['DEXPack']) {
|
||||
const xpack = await window['DEXPack'].mapping[attrs.jsname]
|
||||
plugin.value = xpack.default
|
||||
} else {
|
||||
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({
|
||||
|
||||
<template>
|
||||
<component
|
||||
:class="attrs.jsname"
|
||||
:key="attrs.jsname"
|
||||
ref="pluginProxy"
|
||||
:is="plugin"
|
||||
v-loading="loading"
|
||||
|
Loading…
Reference in New Issue
Block a user