mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 16:22:57 +08:00
fix: 处理编译之后无法生成新数据的bug
This commit is contained in:
parent
e15603bb70
commit
9e9765b573
@ -31,12 +31,29 @@ export let packagesList: PackagesType = {
|
|||||||
* @param targetData
|
* @param targetData
|
||||||
*/
|
*/
|
||||||
export const createComponent = async (targetData: ConfigType) => {
|
export const createComponent = async (targetData: ConfigType) => {
|
||||||
const { redirectComponent, category, key } = targetData
|
const { package: packageName } = targetData
|
||||||
// redirectComponent 是给图片组件库和图标组件库使用的
|
if (packageName === PackagesCategoryEnum.ICONS) {
|
||||||
const componentPath = redirectComponent
|
return createIconComponent()
|
||||||
? `${redirectComponent}/config.ts`
|
} else if (packageName === PackagesCategoryEnum.PHOTOS) {
|
||||||
: `./components/${targetData.package}/${category}/${key}/config.ts`
|
return createPhotoComponent()
|
||||||
const chart = await import(/* @vite-ignore */ componentPath)
|
} else {
|
||||||
|
return createDefaultComponent(targetData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const createIconComponent = async () => {
|
||||||
|
const chart = await import(`./components/Icons/Icon/config`)
|
||||||
|
return new chart.default()
|
||||||
|
}
|
||||||
|
|
||||||
|
export const createPhotoComponent = async () => {
|
||||||
|
const chart = await import(`./components/Informations/Mores/Image/config`)
|
||||||
|
return new chart.default()
|
||||||
|
}
|
||||||
|
|
||||||
|
export const createDefaultComponent = async (targetData: ConfigType) => {
|
||||||
|
const { category, key } = targetData
|
||||||
|
const chart = await import(`./components/${targetData.package}/${category}/${key}/config.ts`)
|
||||||
return new chart.default()
|
return new chart.default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user