mirror of
https://github.com/dataease/dataease.git
synced 2026-06-16 20:42:07 +08:00
fix(X-Pack): 测试
This commit is contained in:
@@ -41,7 +41,7 @@ const importProxy = (bytesArray: any[]) => {
|
||||
`../../../../../../${formatArray(bytesArray[6])}/${formatArray(bytesArray[7])}/${formatArray(
|
||||
bytesArray[8]
|
||||
)}/${formatArray(bytesArray[9])}/${formatArray(bytesArray[10])}.vue`
|
||||
)
|
||||
)
|
||||
promise
|
||||
.then((res: any) => {
|
||||
plugin.value = res.default
|
||||
@@ -65,7 +65,6 @@ useEmitt({
|
||||
})
|
||||
|
||||
const loadComponent = () => {
|
||||
console.log('load-component...1')
|
||||
loading.value = true
|
||||
const byteArray = wsCache.get(`de-plugin-proxy`)
|
||||
if (byteArray) {
|
||||
@@ -98,65 +97,61 @@ const storeCacheProxy = byteArray => {
|
||||
}
|
||||
const pluginProxy = ref(null)
|
||||
const invokeMethod = param => {
|
||||
if (pluginProxy.value && pluginProxy.value['invokeMethod']) {
|
||||
pluginProxy.value['invokeMethod'](param)
|
||||
} else if (param.methodName && pluginProxy.value[param.methodName]) {
|
||||
pluginProxy.value[param.methodName](param.args)
|
||||
}
|
||||
}
|
||||
const emits = defineEmits(['loadFail'])
|
||||
defineExpose({
|
||||
invokeMethod
|
||||
})
|
||||
onMounted(async () => {
|
||||
console.log('plugin index onmounted...')
|
||||
const key = 'xpack-model-distributed'
|
||||
let distributed = false
|
||||
if (wsCache.get(key) === null) {
|
||||
const res = await xpackModelApi()
|
||||
const resData = isNull(res.data) ? 'null' : res.data
|
||||
wsCache.set('xpack-model-distributed', resData)
|
||||
distributed = res.data
|
||||
} else {
|
||||
distributed = wsCache.get(key)
|
||||
}
|
||||
if (isNull(distributed)) {
|
||||
setTimeout(() => {
|
||||
emits('loadFail')
|
||||
loading.value = false
|
||||
}, 1000)
|
||||
return
|
||||
}
|
||||
if (distributed) {
|
||||
if (window['DEXPack']) {
|
||||
const xpack = await window['DEXPack'].mapping[attrs.jsname]
|
||||
console.log('dexpack...', attrs.jsname)
|
||||
if (!xpack) {
|
||||
loadComponent()
|
||||
return
|
||||
}
|
||||
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
|
||||
window['EchartsDE'] = echarts
|
||||
if (!window.tinymce) {
|
||||
window.tinymce = tinymce
|
||||
}
|
||||
loadDistributed()?.then(async res => {
|
||||
new Function(res.data)()
|
||||
useEmitt().emitter.emit('load-xpack')
|
||||
})
|
||||
if (pluginProxy.value['invokeMethod']) {
|
||||
if (pluginProxy.value && pluginProxy.value['invokeMethod']) {
|
||||
pluginProxy.value['invokeMethod'](param)
|
||||
} else if (param.methodName && pluginProxy.value[param.methodName]) {
|
||||
pluginProxy.value[param.methodName](param.args)
|
||||
}
|
||||
} else {
|
||||
loadComponent()
|
||||
}
|
||||
})
|
||||
const emits = defineEmits(['loadFail'])
|
||||
defineExpose({
|
||||
invokeMethod
|
||||
})
|
||||
onMounted(async () => {
|
||||
const key = 'xpack-model-distributed'
|
||||
let distributed = false
|
||||
if (wsCache.get(key) === null) {
|
||||
const res = await xpackModelApi()
|
||||
const resData = isNull(res.data) ? 'null' : res.data
|
||||
wsCache.set('xpack-model-distributed', resData)
|
||||
distributed = res.data
|
||||
} else {
|
||||
distributed = wsCache.get(key)
|
||||
}
|
||||
if (isNull(distributed)) {
|
||||
setTimeout(() => {
|
||||
emits('loadFail')
|
||||
loading.value = false
|
||||
}, 1000)
|
||||
return
|
||||
}
|
||||
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
|
||||
window['EchartsDE'] = echarts
|
||||
if (!window.tinymce) {
|
||||
window.tinymce = tinymce
|
||||
}
|
||||
debugger
|
||||
loadDistributed().then(async res => {
|
||||
new Function(res.data)()
|
||||
useEmitt().emitter.emit('load-xpack')
|
||||
})
|
||||
}
|
||||
} else {
|
||||
loadComponent()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
2
de-xpack
2
de-xpack
Submodule de-xpack updated: e0132981a1...b092832c19
Reference in New Issue
Block a user