12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- // import 'babel-polyfill';
- // import 'require';
- //#pragma warning(disable:18)
- import { createApp, createVNode } from 'vue'
- import App from './App.vue'
- import router from './router/index' //路由
- //element-plus 组件相关
- import ElementPlus, { valueEquals } from 'element-plus'
- import 'element-plus/dist/index.css'
- import zhCn from 'element-plus/es/locale/lang/zh-cn'
- import * as EleIcons from '@element-plus/icons-vue'
- //fragment
- // import Fragment from 'vue-fragment'
- //全局样式
- import './style/main.css'
- import { isValidKey } from '@/utils/utils'
-
- //请求
- import * as request from '@/api/index'
- //全局配置
- import { system } from '@/config'
- //https://xiaoman.blog.csdn.net/article/details/123338137?spm=1001.2014.3001.5502
- import { createPinia } from 'pinia' //一个观察者监听对象
- import { piniaPlugin } from '@/store/plug'
- //导出表格
- //import JsonExcel from 'vue-json-excel'
- import itemIoc from '@/layout/components/ItemIcon.vue'
-
- const app = createApp(App)
-
- //app.component('downloadExcel', JsonExcel)
- //全局注册请求
- app.config.globalProperties.$request = request
- app.config.globalProperties.$system = system
-
- //初始化pinia
- const pinia = createPinia()
- //注册pinia 插件
- pinia.use(piniaPlugin({
- key: "pinia"
- }))
-
- // 全局配置
- app.config.globalProperties.$ELEMENT = {
- size: 'medium', // 设置全局尺寸(可选)
- // 更多全局配置...
- input: {
- clearable: true, // 设置所有输入框的 clearable 为 true
- },
- };
-
- app.use(router).use(pinia).use(ElementPlus, {
- // 使用element-plus
- locale: zhCn,
- })
- import { directive } from '@/utils/trimDirective';
- directive(app);
-
- //全局图标组件
- for (const name in EleIcons) {
- if (isValidKey(name, EleIcons)) {
- app.component(name, EleIcons[name]) //添加图标组件
- }
- }
-
-
- // 下面为全局注册图标组件
- // 创建Icon组件
- const Icon: any = (props: { icon: string }) => {
- const { icon } = props
- return createVNode(EleIcons[icon as keyof typeof EleIcons])
- }
-
- // 注册Icon组件
- app.component('icon-tab', Icon)
- app.component('item-ioc', itemIoc)
-
- app.mount('#app')
|