注册全局组件SVG,集成pinia,封装axios

This commit is contained in:
2024-08-08 19:08:15 +08:00
parent f0cc1b54c2
commit 74bd16dc51
31 changed files with 4753 additions and 122 deletions

View File

@@ -1,37 +1,38 @@
import {createApp} from 'vue'
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 pinia from '@/stores'
import App from './App.vue'
import Router from './router/index';
import Router from './router/index'
// 引入tailwindcss
import '@/assets/styles/tailMain.css'
// 导入全局注册的组件
import 'virtual:svg-icons-register'
import registerGlobComp from '@/components'
//创建实例
const app = createApp(App)
const setupAll = async () => {
app
.use(Router) // 使用路由
.use(ElementPlus) // 使用ele-plus组件
.use(createPinia()) // 使用pinia
app
.use(Router) // 使用路由
.use(ElementPlus) // 使用ele-plus组件
.use(pinia) // 使用pinia
.use(registerGlobComp) // 使用全局自定义组件
// 自动引入图标
Object.keys(ElementPlusIconsVue).forEach((key) => {
app.component(key, ElementPlusIconsVue[key]);
});
//待路由初始化完毕后挂载app
await Router.isReady()
//待路由初始化完毕后挂载app
await Router.isReady()
}
//挂载app
setupAll().then(() => {
app.mount('#app')
})
app.mount('#app')
})