feat: 优化插件导入逻辑,视频插件在移动端进入锁定状态时隐藏上下梯度渐变以防止遮挡视频
This commit is contained in:
1 parent
bfc841fac2
commit
8f8d098faa
4 files changed
+11
-10
No files matched your search
@@ -4,24 +4,22 @@ import { alertTipType, PluginExportType } from "@/types/type";
|
||||
|
||||
const initPlugin = async (globalAlertTip: alertTipType) => {
|
||||
initPluginCenter(globalAlertTip);
|
||||
const modulesFiles = import.meta.glob("@/plugins/**/export.ts");
|
||||
const modulesFiles = import.meta.glob("@/plugins/**/export.ts", { eager: true });
|
||||
const pluginCenter = usePluginCenter();
|
||||
const promiseArray = [];
|
||||
for (let pluginConfig of Object.values(modulesFiles)) {
|
||||
promiseArray.push(
|
||||
new Promise(async resolve => {
|
||||
const _config = pluginConfig as () => Promise<{
|
||||
const _config = pluginConfig as {
|
||||
default: registerComponentOption | Plugin;
|
||||
type: PluginExportType;
|
||||
key?: string;
|
||||
}>;
|
||||
const { type, key } = await _config();
|
||||
};
|
||||
const { type, key } = _config;
|
||||
if (type === PluginExportType.component) {
|
||||
// @ts-ignore
|
||||
resolve(pluginCenter.registerComponent((await _config()).default));
|
||||
resolve(pluginCenter.registerComponent(_config.default as registerComponentOption));
|
||||
} else if (type === PluginExportType.default) {
|
||||
// @ts-ignore
|
||||
resolve(pluginCenter.register(key as string, (await _config()).default));
|
||||
resolve(pluginCenter.register(key as string, _config.default as Plugin));
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user