main.ts 1.0 KB
Newer Older
郝先瑞 已提交
1 2 3
import { createApp, Directive } from 'vue';
import App from './App.vue';
import router from '@/router';
4

郝先瑞 已提交
5
import { createPinia } from 'pinia';
郝先瑞 已提交
6

郝先瑞 已提交
7 8 9 10
import ElementPlus from 'element-plus';
import 'element-plus/theme-chalk/index.css';
import Pagination from '@/components/Pagination/index.vue';
import '@/permission';
郝先瑞 已提交
11

12 13
import 'default-passive-events'

14
// 引入svg注册脚本
郝先瑞 已提交
15
import 'virtual:svg-icons-register';
有来技术 已提交
16

17
// 国际化
郝先瑞 已提交
18
import i18n from '@/lang/index';
19 20

// 自定义样式
郝先瑞 已提交
21
import '@/styles/index.scss';
22

郝先瑞 已提交
23
// 根据字典编码获取字典列表全局方法
郝先瑞 已提交
24
import { listDictsByCode } from '@/api/system/dict';
有来技术 已提交
25

郝先瑞 已提交
26
const app = createApp(App);
27

28
// 自定义指令
郝先瑞 已提交
29
import * as directive from '@/directive';
郝先瑞 已提交
30

31
Object.keys(directive).forEach(key => {
郝先瑞 已提交
32
  app.directive(key, (directive as { [key: string]: Directive })[key]);
33 34
});

35
// 全局方法
郝先瑞 已提交
36
app.config.globalProperties.$listDictsByCode = listDictsByCode;
郝先瑞 已提交
37

郝先瑞 已提交
38
// 注册全局组件
郝先瑞 已提交
39
app
郝先瑞 已提交
40 41 42 43 44 45
  .component('Pagination', Pagination)
  .use(createPinia())
  .use(router)
  .use(ElementPlus)
  .use(i18n)
  .mount('#app');