xyadmin-web/src/main.js
2025-05-27 18:56:00 +08:00

74 lines
2.0 KiB
JavaScript

import Vue from 'vue'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import '@/styles/index.scss' // global css
import App from './App'
import router from './router/routers'
import permission from './components/Permission'
import dict from './components/Dict'
import ImportData from './components/ImportData'
Vue.component('ImportData', ImportData)
import store from './store'
import {
parseTime,
resetForm,
addDateRange,
selectDictLabel,
selectDictLabels,
handleTree,
} from "@/utils/ruoyi";
Vue.prototype.parseTime = parseTime;
import '@/icons' // icon
import './router/index' // permission control
import Router from 'vue-router'
import * as fiters from './libs/numFormat'
import AFTableColumn from 'af-table-column'
import { Message } from 'element-ui'
import * as math from 'mathjs' // 新版本需要这样引入 感谢评论区的指出
Vue.prototype.$math = math
Vue.prototype.$delectAuth = function () {
const name = localStorage.getItem('name')
if (name != '岳小强') {
Message.error('请联系管理员')
return false
} else {
return true
}
}
Vue.use(AFTableColumn)
// 注册金额格式化过滤器
// Vue.filter('numFormat', numFormat)
// import * as filters from '@filters/filters'
Object.keys(fiters).forEach(key => {
Vue.filter(key, fiters[key])
})
// Object.keys(numFormat).forEach = function push(location) {
// return routerPush.call(this, location).catch(error => error)
// }
Vue.use(mavonEditor)
Vue.use(permission)
Vue.use(dict)
Vue.use(ElementUI, { locale })
Vue.config.productionTip = false
const routerPush = Router.prototype.push
Router.prototype.push = function push (location) {
return routerPush.call(this, location).catch(error => error)
}
require('babel-polyfill')
new Vue({
el: '#app',
router,
store,
render: h => h(App)
})