mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
feat: 新增组件预览
This commit is contained in:
@@ -1,6 +1,24 @@
|
||||
import type { App } from 'vue'
|
||||
import { Skeleton } from '@/components/Skeleton'
|
||||
import { LoadingComponent } from '@/components/LoadingComponent'
|
||||
import { getLocalStorageInfo } from '@/views/preview/utils/index'
|
||||
import { fetchChartComponent } from '@/packages/index'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
|
||||
/**
|
||||
* * 预览页面动态注册 package 组件
|
||||
* @param app
|
||||
*/
|
||||
export const setupPreviewPackages = (app: App) => {
|
||||
const localStorageInfo = getLocalStorageInfo()
|
||||
if(!document.location.hash.includes('preview') || !localStorageInfo) return
|
||||
localStorageInfo.componentList.forEach(async (e: CreateComponentType) => {
|
||||
if (!app.component(e.key)) {
|
||||
const chart = fetchChartComponent(e.chartConfig)
|
||||
app.component(e.key, chart)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 全局注册自定义组件
|
||||
|
||||
Reference in New Issue
Block a user