mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-12 18:11:34 +08:00
fix: Modify execute list
This commit is contained in:
@@ -345,7 +345,7 @@ const usePluginLoader = () => {
|
||||
// resetRouterConfig(routerConfig);
|
||||
console.log(routerConfig)
|
||||
// setFinalRouterConfig(routerConfig)
|
||||
installPlugin(routerConfig, executeList).then((res)=>{
|
||||
installPlugin(routerConfig).then((res)=>{
|
||||
resolve(res)
|
||||
})
|
||||
// .then(async () => {
|
||||
@@ -356,7 +356,7 @@ const usePluginLoader = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const installPlugin = (routerConfig: any[], executeList: never[]) => {
|
||||
const installPlugin = (routerConfig: any[]) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// fetchData('system/plugins',{method:'GET'}).then((resp) => {
|
||||
// if (resp.code === 0){
|
||||
@@ -385,7 +385,7 @@ const usePluginLoader = () => {
|
||||
}
|
||||
console.log(driverName)
|
||||
const driver = driverName.split('.').reduce((driverMethod: { [x: string]: any; }, driverName: string | number) => driverMethod[driverName], driverMethod);
|
||||
driver({ routerConfig, executeList, pluginLoader, pluginProvider, pluginLifecycleGuard, builtInPluginLoader }, plugin);
|
||||
driver({ routerConfig, setExecuteList, pluginLoader, pluginProvider, pluginLifecycleGuard, builtInPluginLoader }, plugin);
|
||||
} catch (err) {
|
||||
console.warn('安装插件出错:', err);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ interface PluginConfig {
|
||||
|
||||
export interface CoreObj {
|
||||
routerConfig: RouteConfig[];
|
||||
executeList: unknown[];
|
||||
setExecuteList: (param:unknown[])=>void;
|
||||
pluginLoader: PluginLoaderService;
|
||||
pluginLifecycleGuard: PluginLifecycleGuard;
|
||||
pluginProvider: PluginProviderService;
|
||||
@@ -174,7 +174,7 @@ export const ApiparkPluginDriver:{[key:string]:{[key:string]:(coreObj?:CoreObj,
|
||||
},
|
||||
preload: (coreObj?:CoreObj, pluginConfig?:PluginConfig) => {
|
||||
if(!coreObj || !pluginConfig) return coreObj
|
||||
coreObj.executeList.push({ ...pluginConfig, expose: 'Bootstrap', bootstrap: 'BootstrapModule.bootstrap' })
|
||||
coreObj.setExecuteList(prev=>[...prev,{ ...pluginConfig, expose: 'Bootstrap', bootstrap: 'BootstrapModule.bootstrap' }])
|
||||
for (const pluginRouter of pluginConfig.router) {
|
||||
updateRouterConfigWithPlugin(coreObj, pluginRouter, pluginConfig)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user