项目初始化
This commit is contained in:
@@ -20,58 +20,77 @@ 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'
|
||||
import VScaleScreen from 'v-scale-screen'
|
||||
import * as echarts from 'echarts'
|
||||
|
||||
// 引入大屏适配插件
|
||||
import VScaleScreen from 'v-scale-screen'
|
||||
|
||||
// 引入 ECharts
|
||||
import * as echarts from 'echarts'
|
||||
import type { ECharts } from 'echarts' // 补充类型声明
|
||||
|
||||
// 引入 ElementPlus 中文
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
|
||||
// 扩展全局属性类型(解决 TS 类型报错)
|
||||
declare module 'vue' {
|
||||
interface ComponentCustomProperties {
|
||||
$echarts: ECharts
|
||||
}
|
||||
}
|
||||
|
||||
async function bootstrap() {
|
||||
const app = createApp(App);
|
||||
|
||||
app.use(VScaleScreen)
|
||||
// 全局挂载 ECharts
|
||||
app.config.globalProperties.$echarts = echarts
|
||||
|
||||
|
||||
// 使用大屏自适应组件
|
||||
app.use(VScaleScreen)
|
||||
|
||||
// 使用 ElementPlus
|
||||
app.use(ElementPlus, {
|
||||
locale: zhCn,
|
||||
})
|
||||
|
||||
|
||||
// 注册 ElementPlus 所有图标
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
}
|
||||
|
||||
// Configure store
|
||||
// 配置状态管理 Pinia
|
||||
setupStore(app);
|
||||
|
||||
// Initialize internal system configuration
|
||||
// 初始化系统内部配置
|
||||
initAppConfigStore();
|
||||
|
||||
// Register global components
|
||||
// 注册全局自定义组件
|
||||
registerGlobComp(app);
|
||||
|
||||
// Multilingual configuration
|
||||
// Asynchronous case: language files may be obtained from the server side
|
||||
// 多语言配置
|
||||
await setupI18n(app);
|
||||
|
||||
// Configure routing
|
||||
// 配置路由
|
||||
setupRouter(app);
|
||||
|
||||
// router-guard
|
||||
// 路由守卫(权限、加载、日志等)
|
||||
setupRouterGuard(router);
|
||||
|
||||
// Register global directive
|
||||
// 注册全局自定义指令
|
||||
setupGlobDirectives(app);
|
||||
|
||||
// Configure global error handling
|
||||
// 配置全局错误处理
|
||||
setupErrorHandle(app);
|
||||
|
||||
// https://next.router.vuejs.org/api/#isready
|
||||
// await router.isReady();
|
||||
|
||||
// Dynamic Form
|
||||
// 初始化动态表单
|
||||
setupDForm();
|
||||
|
||||
// 挂载应用
|
||||
app.mount('#app');
|
||||
}
|
||||
|
||||
// 启动应用
|
||||
bootstrap().then();
|
||||
|
||||
Reference in New Issue
Block a user