初始化项目
This commit is contained in:
@@ -9,7 +9,7 @@ import '@jeesite/core/design/index.less';
|
||||
|
||||
import App from './App.vue';
|
||||
import { createApp } from 'vue';
|
||||
import { isDevMode } from '@jeesite/core/utils/env';
|
||||
|
||||
import { registerGlobComp } from '@jeesite/core/components/registerGlobComp';
|
||||
import { initAppConfigStore } from '@jeesite/core/logics/initAppConfig';
|
||||
import { setupErrorHandle } from '@jeesite/core/logics/error-handle';
|
||||
@@ -20,77 +20,73 @@ import { setupRouterGuard } from '@jeesite/core/router/guard';
|
||||
import { setupStore } from '@jeesite/core/store';
|
||||
import { setupDForm } from '@jeesite/dfm';
|
||||
|
||||
// 引入 ElementPlus
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css' // ✅ 必须添加 ElementPlus 样式
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
// ElementPlus
|
||||
import ElementPlus from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
||||
|
||||
// 引入大屏适配插件
|
||||
import VScaleScreen from 'v-scale-screen'
|
||||
// 大屏自适应
|
||||
import VScaleScreen from 'v-scale-screen';
|
||||
|
||||
// 引入 ECharts
|
||||
import * as echarts from 'echarts'
|
||||
import type { ECharts } from 'echarts' // 补充类型声明
|
||||
// ECharts
|
||||
import * as echarts from 'echarts';
|
||||
|
||||
// 引入 ElementPlus 中文
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
|
||||
// 扩展全局属性类型(解决 TS 类型报错)
|
||||
declare module 'vue' {
|
||||
interface ComponentCustomProperties {
|
||||
$echarts: ECharts
|
||||
$echarts: typeof echarts;
|
||||
}
|
||||
}
|
||||
|
||||
async function bootstrap() {
|
||||
// 创建 Vue 实例
|
||||
const app = createApp(App);
|
||||
|
||||
// 全局挂载 ECharts
|
||||
app.config.globalProperties.$echarts = echarts
|
||||
|
||||
// 使用大屏自适应组件
|
||||
app.use(VScaleScreen)
|
||||
app.config.globalProperties.$echarts = echarts;
|
||||
|
||||
// 使用 ElementPlus
|
||||
// 2. 注册大屏自适应插件
|
||||
app.component('VScaleScreen', VScaleScreen)
|
||||
|
||||
// 3. 注册 ElementPlus(中文语言)
|
||||
app.use(ElementPlus, {
|
||||
locale: zhCn,
|
||||
})
|
||||
});
|
||||
|
||||
// 注册 ElementPlus 所有图标
|
||||
// 4. 全局注册 ElementPlus 所有图标
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
app.component(key, component);
|
||||
}
|
||||
|
||||
// 配置状态管理 Pinia
|
||||
// 5. 状态管理 Pinia 初始化
|
||||
setupStore(app);
|
||||
|
||||
// 初始化系统内部配置
|
||||
// 6. 初始化系统配置(主题、布局、全局设置)
|
||||
initAppConfigStore();
|
||||
|
||||
// 注册全局自定义组件
|
||||
// 7. 注册全局自定义组件
|
||||
registerGlobComp(app);
|
||||
|
||||
// 多语言配置
|
||||
// 8. 国际化多语言初始化
|
||||
await setupI18n(app);
|
||||
|
||||
// 配置路由
|
||||
// 9. 路由注册
|
||||
setupRouter(app);
|
||||
|
||||
// 路由守卫(权限、加载、日志等)
|
||||
// 10. 路由守卫(权限控制、页面加载、登录拦截)
|
||||
setupRouterGuard(router);
|
||||
|
||||
// 注册全局自定义指令
|
||||
// 11. 全局自定义指令(权限、防抖、拖拽等)
|
||||
setupGlobDirectives(app);
|
||||
|
||||
// 配置全局错误处理
|
||||
// 12. 全局异常捕获处理
|
||||
setupErrorHandle(app);
|
||||
|
||||
// 初始化动态表单
|
||||
// 13. 动态表单模块初始化
|
||||
setupDForm();
|
||||
|
||||
// 挂载应用
|
||||
// 14. 挂载应用到页面 #app 节点
|
||||
app.mount('#app');
|
||||
}
|
||||
|
||||
// 启动应用
|
||||
bootstrap().then();
|
||||
// 执行启动
|
||||
bootstrap().then();
|
||||
Reference in New Issue
Block a user