Files
vue3-element-admin/src/main.ts
2022-02-27 12:55:22 +08:00

41 lines
1023 B
TypeScript

import {createApp, Directive} from 'vue'
import App from './App.vue'
import router from "@/router";
import {store} from "@/store";
import Pagination from '@/components/Pagination/index.vue'
import {localStorage} from "@/utils/storage";
import 'virtual:svg-icons-register';
import '@/permission'
import ElementPlus from 'element-plus'
import 'element-plus/theme-chalk/index.css'
// 国际化
import i18n from "@/lang/index";
// 自定义样式
import '@/styles/index.scss'
// 全局方法
import {listDictsByCode} from '@/api/system/dict'
const app = createApp(App)
// 自定义指令
import * as directive from "@/directive";
Object.keys(directive).forEach(key => {
app.directive(key, (directive as { [key: string]: Directive })[key]);
});
// 全局方法
app.config.globalProperties.$listDictsByCode = listDictsByCode
app.component('Pagination', Pagination) // 全局组件
.use(store)
.use(router)
.use(ElementPlus, {size: localStorage.get('size') || 'small'})
.use(i18n)
.mount('#app')