//vue 项目在ie浏览器的兼容问题
|
//import '@babel/polyfill';
|
import promise from 'es6-promise'
|
import { createApp, nextTick } from 'vue'
|
import App from './App.vue'
|
import i18n, { setLanguage } from "../public/assets/i18n/i18n";
|
import svgIcon from './components/common/svgIcon.vue'
|
import './index.css'
|
import router from './router'
|
import axios from 'axios'
|
import 'default-passive-events'
|
import Vue3SeamlessScroll from "vue3-seamless-scroll"
|
import ElementPlus from 'element-plus'
|
import 'element-plus/dist/index.css'
|
import 'element-plus/theme-chalk/display.css'
|
import './element-variables.scss'
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
import elementEnLocale from 'element-plus/dist/locale/en.mjs' // element-ui英文包
|
import elementZhLocale from 'element-plus/dist/locale/zh-cn.mjs' // element-ui中文包
|
import elementRuLocale from 'element-plus/dist/locale/ru.mjs' // element-ui俄语包
|
import { postRequest, postKeyValueRequest, putRequest, deleteRequest, getRequest } from "./utils/axioshttp"
|
import Cookies from "js-cookie";
|
import JsonViewer from "vue3-json-viewer";
|
import "vue3-json-viewer/dist/index.css";
|
import { createPinia } from 'pinia'
|
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
import { dialogdrag, prefixDirective, thousandsDirective } from './utils/directive'
|
import BasicNavigator from './router/navigators/basicNavigator';
|
|
promise.polyfill()
|
axios.defaults.withCredentials = false
|
Object.fromEntries = (entries) => { //为低版本浏览器重构fromEntries
|
const map = new Map();
|
for (let i = 0; i < entries.length; i++) {
|
map.set(entries[i][0], entries[i][1])
|
}
|
|
return map;
|
}
|
|
const pinia = createPinia();
|
pinia.use(piniaPluginPersistedstate)
|
|
import { Boot } from '@wangeditor/editor'
|
import formulaModule from "@wangeditor/plugin-formula";
|
// 注册。要在创建编辑器之前注册,且只能注册一次,不可重复注册。
|
Boot.registerModule(formulaModule);
|
|
const app = createApp(App)
|
app.config.errorHandler = (err, vm, info) => {
|
// 处理错误
|
// `info` 是 Vue 特定的错误信息,比如错误所在的生命周期钩子
|
console.error(err, vm, info);
|
}
|
app.config.warnHandler = function (msg, vm, trace) {
|
// `trace` 是组件的继承关系追踪
|
console.warn(msg, vm, trace);
|
}
|
app.config.productionTip = false
|
app.config.globalProperties.Cookies = Cookies
|
app.config.globalProperties.postRequest = postRequest
|
app.config.globalProperties.postKeyValueRequest = postKeyValueRequest
|
app.config.globalProperties.putRequest = putRequest
|
app.config.globalProperties.deleteRequest = deleteRequest
|
app.config.globalProperties.getRequest = getRequest
|
app.config.globalProperties.$axios = axios
|
app.config.globalProperties.openLoading = function (target) {
|
const loading = this.$loading({ // 声明一个loading对象
|
lock: true, // 是否锁屏
|
text: `${this.$t('label.Loading')}`, // 加载动画的文字
|
spinner: 'el-icon-loading', // 引入的loading图标
|
background: 'rgba(0, 0, 0, 0.7)', // 背景颜色
|
target: target, // 需要遮罩的区域
|
body: false,
|
class: 'mask' // 遮罩层新增类名
|
});
|
// 设定定时器,超时10S后自动关闭遮罩层,避免请求失败时,遮罩层一直存在的问题
|
setTimeout(function () {
|
loading.close();
|
}, 20000)
|
return loading;
|
}
|
|
app.directive('dialogdrag', {
|
beforeMount() {
|
},
|
mounted(el) {
|
//dialogdrag(el)
|
}
|
})
|
|
|
// input金额展示千分位
|
app.directive("thousands", thousandsDirective);
|
// input前缀符号
|
app.directive('prefix', prefixDirective);
|
|
app.use(BasicNavigator)
|
app.use(i18n)
|
app.use(Vue3SeamlessScroll)
|
app.use(ElementPlus, {
|
locale: Cookies.get('language') === 'zh_cn' ? elementZhLocale : Cookies.get('language') === 'en_us' ? elementEnLocale : Cookies.get('language') === 'ru' ? elementRuLocale : elementEnLocale,
|
size: 'small',
|
zIndex: 3000
|
})
|
app.use(pinia)
|
app.use(router)
|
app.use(JsonViewer);
|
app.component('svg-icon', svgIcon);
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
app.component(key, component)
|
}
|
|
setLanguage().then((i18n) => {
|
app.config.globalProperties.$i18n = i18n;
|
}).catch((error) => {
|
console.error(error);
|
}).finally(() => {
|
app.mount('#app')
|
})
|