2024-07-22 16:03:59 +00:00
|
|
|
import { initPreferences } from '@vben/preferences';
|
2024-07-30 13:05:03 +00:00
|
|
|
import { unmountGlobalLoading } from '@vben/utils';
|
2024-05-19 13:20:42 +00:00
|
|
|
|
2024-06-01 15:15:29 +00:00
|
|
|
import { overridesPreferences } from './preferences';
|
2024-05-19 13:20:42 +00:00
|
|
|
|
2024-05-24 15:11:03 +00:00
|
|
|
/**
|
|
|
|
* 应用初始化完成之后再进行页面加载渲染
|
|
|
|
*/
|
|
|
|
async function initApplication() {
|
2024-06-01 15:15:29 +00:00
|
|
|
// name用于指定项目唯一标识
|
|
|
|
// 用于区分不同项目的偏好设置以及存储数据的key前缀以及其他一些需要隔离的数据
|
2024-05-24 15:11:03 +00:00
|
|
|
const env = import.meta.env.PROD ? 'prod' : 'dev';
|
2024-07-28 06:29:05 +00:00
|
|
|
const appVersion = import.meta.env.VITE_APP_VERSION;
|
|
|
|
const namespace = `${import.meta.env.VITE_APP_NAMESPACE}-${appVersion}-${env}`;
|
2024-05-24 15:11:03 +00:00
|
|
|
|
|
|
|
// app偏好设置初始化
|
2024-07-22 16:03:59 +00:00
|
|
|
await initPreferences({
|
2024-05-24 15:11:03 +00:00
|
|
|
namespace,
|
2024-06-01 15:15:29 +00:00
|
|
|
overrides: overridesPreferences,
|
2024-05-19 13:20:42 +00:00
|
|
|
});
|
|
|
|
|
2024-06-02 15:50:58 +00:00
|
|
|
// 启动应用并挂载
|
|
|
|
// vue应用主要逻辑及视图
|
|
|
|
const { bootstrap } = await import('./bootstrap');
|
|
|
|
await bootstrap(namespace);
|
|
|
|
|
|
|
|
// 移除并销毁loading
|
2024-07-28 06:29:05 +00:00
|
|
|
unmountGlobalLoading();
|
2024-05-19 13:20:42 +00:00
|
|
|
}
|
|
|
|
|
2024-05-24 15:11:03 +00:00
|
|
|
initApplication();
|