注册全局组件SVG,集成pinia,封装axios
This commit is contained in:
@@ -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')
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user