You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.0 KiB
36 lines
1.0 KiB
7 months ago
|
|
||
|
|
||
|
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);
|
||
|
}
|