import type { App } from 'vue'; import 'virtual:svg-icons-register'; import { registerGlobalComponent } from './register-global-component'; import { appConfigStore } from '/nerv-lib/saas/store/modules/app-config'; import { setupStore } from './store'; import { setupRouter, router } from './router'; import { http, systemInfo } from '/nerv-lib/util'; export function saasInit(config: { app: App; apiModule: object; appConfig: any; defaultResource?: any; }) { systemInfo(); const { app, apiModule, appConfig, defaultResource } = config; http.apiModule = apiModule; http.projectType = appConfig.projectType; http.setTimeout(appConfig.timeout); http.setHeaders(appConfig.headers); app.config.globalProperties.$appConfig = appConfig; // http.in console.log(router.getRoutes()); setupStore(app); const configStore = appConfigStore(); configStore.setConfig(appConfig); if (defaultResource) { configStore.initDefaultResource(defaultResource); } registerGlobalComponent(app); setupRouter(app); }