111 lines
3.1 KiB
TypeScript
111 lines
3.1 KiB
TypeScript
import { createApp } from 'vue';
|
|
import App from './App.vue';
|
|
import store from './store';
|
|
import Bus from './bus'/// mitt 总线程引入
|
|
|
|
// @ts-ignore
|
|
import router from '~/router/index.ts';
|
|
import 'virtual:windi.css';
|
|
// import { useClipboard } from 'vue-use';
|
|
|
|
import JsonViewer from "vue3-json-viewer";
|
|
import "vue3-json-viewer/dist/index.css"; // 引入样式
|
|
// @ts-ignore
|
|
// eslint-disable-next-line import/order
|
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
|
|
|
|
import 'element-plus/theme-chalk/el-message.css';
|
|
import 'element-plus/theme-chalk/el-message-box.css';
|
|
import 'element-plus/theme-chalk/el-button.css';
|
|
// import '@wangeditor/editor/dist/css/style.css'; // 富文本 css
|
|
|
|
import './permission.js';
|
|
|
|
|
|
// @ts-ignore
|
|
import directive from './directive/index.js'; // directive
|
|
// svg图标
|
|
import 'virtual:svg-icons-register';
|
|
import SvgIcon from '@/components/SvgIcon/index.vue';
|
|
// @ts-ignore
|
|
// import elementIcons from '@/components/SvgIcon/svgicon.js';
|
|
|
|
// @ts-ignore
|
|
import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/aiotagro.js';
|
|
|
|
// nprogress
|
|
import 'nprogress/nprogress.css';
|
|
|
|
import '~/styles/index.scss';
|
|
import print from 'vue3-print-nb'
|
|
// BaiduMap
|
|
import BaiduMap from 'vue-baidu-map-3x'
|
|
|
|
|
|
// 创建vue实例
|
|
const app = createApp(App);
|
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
|
app.component(key, component);
|
|
}
|
|
// 全局方法挂载
|
|
// app.config.globalProperties.useDict = useDict
|
|
// app.config.globalProperties.download = download
|
|
app.config.globalProperties.$bus = Bus;
|
|
app.config.globalProperties.parseTime = parseTime;
|
|
app.config.globalProperties.resetForm = resetForm;
|
|
app.config.globalProperties.handleTree = handleTree;
|
|
app.config.globalProperties.addDateRange = addDateRange;
|
|
app.config.globalProperties.selectDictLabel = selectDictLabel;
|
|
app.config.globalProperties.selectDictLabels = selectDictLabels;
|
|
|
|
// 全局方法示例
|
|
|
|
// import { getCurrentInstance } from 'vue'
|
|
// const { proxy } = getCurrentInstance()
|
|
|
|
// proxy.$Bus.$emit('getParams',123)
|
|
|
|
// proxy.$Bus.$on('getParams', (params) => {
|
|
// console.log(params) // 123
|
|
// })
|
|
|
|
// 离开路由关闭线程
|
|
// proxy.$Bus.$emit('getParams')
|
|
|
|
directive(app);
|
|
// app.use(elementIcons);
|
|
app.component('svg-icon', SvgIcon);
|
|
|
|
// 挂载pinia
|
|
app.use(store);
|
|
|
|
app.use(print)
|
|
// 输入框只能输入英文和数字
|
|
app.directive('input-english', {
|
|
mounted(el: any) {
|
|
el.addEventListener('input', (event: any) => {
|
|
const value = event.target.value;
|
|
const englishOnlyValue = value.replace(/[^\x00-\x7F]/g, '');
|
|
|
|
if (value !== englishOnlyValue) {
|
|
event.target.value = englishOnlyValue;
|
|
}
|
|
});
|
|
},
|
|
});
|
|
|
|
app.use(JsonViewer);
|
|
|
|
app.use(BaiduMap, {
|
|
// ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
|
|
ak: 'xITbC7jegaAAuu4m9jC2Zx6eFbQJ29Rj', //
|
|
// v: '2.0', // 默认使用3.0
|
|
// type: 'WebGL' // ||API 默认API (使用此模式 BMap=BMapGL)
|
|
// type: 'WebGL', // ||API 默认API (使用此模式 BMap=BMapGL)
|
|
// v: '2.0',
|
|
// type:'WebGL'
|
|
});
|
|
// 挂载 router
|
|
app.use(router);
|
|
app.mount('#app');
|