mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 提交动态注册的代码
This commit is contained in:
+15
-2
@@ -1,11 +1,24 @@
|
||||
import { defineAsyncComponent, AsyncComponentLoader } from 'vue'
|
||||
import { AsyncLoading, AsyncSkeletonLoading } from '@/components/LoadingComponent'
|
||||
|
||||
import { ConfigType } from '@/packages/index.d'
|
||||
import { fetchChartComponent } from '@/packages/index'
|
||||
/**
|
||||
* * 预览页面动态注册 package 组件
|
||||
* @param {ConfigType} dropData
|
||||
*/
|
||||
export const componentPackageInstall = async (dropData: Omit<ConfigType, "node">) => {
|
||||
const key = dropData.key.substring(1)
|
||||
console.log(window['$vue']);
|
||||
if (!window['$vue'].component(key)) {
|
||||
const chart = await fetchChartComponent(dropData)
|
||||
window['$vue'].component(key, chart)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* * 动态注册组件
|
||||
*/
|
||||
export const componentInstall = <T> (key:string, node: T) => {
|
||||
if(!window['$vue'].component(key) && key && node) {
|
||||
if(!window['$vue'].component(key) && node) {
|
||||
window['$vue'].component(key, node)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user