初始化

This commit is contained in:
2026-04-22 10:49:46 +08:00
commit 1312131b1e
283 changed files with 30175 additions and 0 deletions

45
src/main.ts Normal file
View File

@@ -0,0 +1,45 @@
import './styles/tailwind.css';
import './styles/index.less';
import { createApp } from 'vue';
import { setupNaiveDiscreteApi, setupNaive, setupDirectives } from '@/plugins';
import App from './App.vue';
import router, { setupRouter } from './router';
import { setupStore } from '@/store';
async function bootstrap() {
const app = createApp(App);
// 挂载状态管理
setupStore(app);
// 注册全局常用的 naive-ui 组件
setupNaive(app);
// 挂载 naive-ui 脱离上下文的 Api
setupNaiveDiscreteApi();
// 注册全局自定义组件
//setupCustomComponents();
// 注册全局自定义指令v-permission权限指令
setupDirectives(app);
// 注册全局方法app.config.globalProperties.$message = message
//setupGlobalMethods(app);
// 挂载路由
setupRouter(app);
// 路由准备就绪后挂载 APP 实例
// https://router.vuejs.org/api/interfaces/router.html#isready
await router.isReady();
// https://www.naiveui.com/en-US/os-theme/docs/style-conflict#About-Tailwind's-Preflight-Style-Override
const meta = document.createElement('meta');
meta.name = 'naive-ui-style';
document.head.appendChild(meta);
app.mount('#app', true);
}
void bootstrap();