init项目
This commit is contained in:
37
frontend/src/main.ts
Normal file
37
frontend/src/main.ts
Normal 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')
|
||||
})
|
||||
Reference in New Issue
Block a user