feat: 添加主页插件支持

This commit is contained in:
539943419 committed 2024-09-30 23:21:05 +08:00
1 parent 1f42785b4a
commit 90a068939d
11 files changed
+184 -82

No files matched your search

+5 -5
View File
@@ -3,7 +3,7 @@ import { Plugin, registerComponentOption } from "@/class/PluginCenter";
import { alertTipType, PluginExportType } from "@/types/type";
const initPlugin = async (globalAlertTip: alertTipType) => {
initPluginCenter(globalAlertTip)
initPluginCenter(globalAlertTip);
const modulesFiles = import.meta.glob("@/plugins/**/export.ts");
const pluginCenter = usePluginCenter();
const promiseArray = [];
@@ -12,11 +12,11 @@ const initPlugin = async (globalAlertTip: alertTipType) => {
new Promise(async resolve => {
const _config = pluginConfig as () => Promise<{
default: registerComponentOption | Plugin;
type: PluginExportType
key?: string
type: PluginExportType;
key?: string;
}>;
const {type, key} = await _config()
if(type === PluginExportType.component) {
const { type, key } = await _config();
if (type === PluginExportType.component) {
// @ts-ignore
resolve(pluginCenter.registerComponent((await _config()).default));
} else if (type === PluginExportType.default) {