mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
feat: 新增组件预览
This commit is contained in:
+15
-10
@@ -10,18 +10,25 @@ import { InformationList } from '@/packages/components/Informations/index'
|
||||
import { TableList } from '@/packages/components/Tables/index'
|
||||
|
||||
// * 所有图表
|
||||
let packagesList: PackagesType = {
|
||||
export let packagesList: PackagesType = {
|
||||
[PackagesCategoryEnum.CHARTS]: ChartList,
|
||||
[PackagesCategoryEnum.INFORMATION]: InformationList,
|
||||
[PackagesCategoryEnum.TABLES]: TableList,
|
||||
[PackagesCategoryEnum.DECORATES]: DecorateList
|
||||
}
|
||||
|
||||
export const packgeInstall = (app:App) => {
|
||||
ChartList.forEach(e=>{
|
||||
console.log(e)
|
||||
app.component(e.key, e.node)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* * 获取目标拖拽组件信息
|
||||
* * 获取目标拖拽组件配置信息
|
||||
* @param dropData
|
||||
*/
|
||||
const createComponent = async (dropData: ConfigType) => {
|
||||
export const createComponent = async (dropData: ConfigType) => {
|
||||
const { category } = dropData
|
||||
const key = dropData.key.substring(1)
|
||||
const chart = await import(`./components/${dropData.package}/${category}/${key}/config.ts`)
|
||||
@@ -30,11 +37,9 @@ const createComponent = async (dropData: ConfigType) => {
|
||||
|
||||
/**
|
||||
* * 获取组件信息
|
||||
* * import.meta.globEager 不好使,先从原来的位置拿把
|
||||
*/
|
||||
const fetchChartComponent = async (dropData: ConfigType | Omit<ConfigType, "node">) => {
|
||||
const key = dropData.key.substring(1)
|
||||
const { category } = dropData
|
||||
return await import(`../packages/components/${dropData.package}/${category}/${key}/index.vue`)
|
||||
}
|
||||
|
||||
export { packagesList, createComponent, fetchChartComponent }
|
||||
export const fetchChartComponent = (dropData: ConfigType | Omit<ConfigType, "node" | 'conNode'>) => {
|
||||
const { key, package:packageName } = dropData
|
||||
return packagesList[packageName as PackagesCategoryEnum].filter(e=> e.key === key)[0].node()
|
||||
}
|
||||
Reference in New Issue
Block a user