init项目

This commit is contained in:
2024-08-07 21:48:57 +08:00
parent 1581a5aaf5
commit ee58452db1
19 changed files with 428 additions and 0 deletions

37
frontend/src/main.ts Normal file
View File

@@ -0,0 +1,37 @@
import {createApp} from 'vue'
// element-plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
// 使用pinia
import { createPinia } from 'pinia'
import App from './App.vue'
import Router from './router/index';
// 引入tailwindcss
import '@/assets/styles/tailMain.css'
//创建实例
const app = createApp(App)
const setupAll = async () => {
app
.use(Router) // 使用路由
.use(ElementPlus) // 使用ele-plus组件
.use(createPinia()) // 使用pinia
// 自动引入图标
Object.keys(ElementPlusIconsVue).forEach((key) => {
app.component(key, ElementPlusIconsVue[key]);
});
//待路由初始化完毕后挂载app
await Router.isReady()
}
//挂载app
setupAll().then(() => {
app.mount('#app')
})