Files
yinnihailiang_one/lms/nladmin-ui/src/main.js
2026-01-04 17:10:04 +08:00

98 lines
2.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Vue from 'vue'
import 'normalize.css/normalize.css'
import Element from 'element-ui'
import 'font-awesome/css/font-awesome.css'
// vue中markdown编辑器
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
// 数据字典
import dict from './components/Dict'
import scroll from 'vue-seamless-scroll'
// 权限指令
import permission from './components/Permission'
import './assets/styles/element-variables.scss'
// global css
import './assets/styles/index.scss'
// add-xy start
import i18n from './i18n'
import { fetchMessages } from '@/api/i18n' // 有一个API模块来获取语言文件
// 当前语言可以从本地存储、用户设置或URL参数中获取
const currentLocale = localStorage.getItem('lang')
// 代码高亮
import VueHighlightJS from 'vue-highlightjs'
import 'highlight.js/styles/atom-one-dark.css'
import App from './App'
import store from './store'
import router from './router/routers'
import './assets/icons' // icon
import './router/index' // permission control
import 'echarts-gl'
import 'jquery'
// 全局引入LogicFlow
import LogicFlow from '@logicflow/core'
import { Menu } from '@logicflow/extension'
import '@logicflow/extension/lib/style/index.css'
// Form Generator 组件需要使用到 tinymce
import Tinymce from '@/views/system/build/tinymce/index.vue'
import request from '@/utils/request' // 实现 form generator 使用自己定义的 axios request 对象
import { addDateRange, handleTree, parseTime, resetForm, selectDictLabel, selectDictLabels, flexWidth } from '@/utils/nladmin'
import { getValueByCode } from '@/api/system/param'
LogicFlow.use(Menu)
Vue.component('tinymce', Tinymce)
Vue.prototype.$axios = request
// 全局方法挂载
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.handleTree = handleTree
Vue.prototype.getValueByCode = getValueByCode
Vue.prototype.flexWidth = flexWidth
Vue.use(scroll)
Vue.use(VueHighlightJS)
Vue.use(mavonEditor)
Vue.use(permission)
Vue.use(dict)
// 全局设置控件样式https://codeantenna.com/a/0IN5FMJk5h
Element.Table.props.border = { type: Boolean, default: true }
Element.TableColumn.props.align = { type: String, default: 'center' }
Vue.use(Element, {
size: 'mini' // set element-ui default size
})
Vue.config.productionTip = false
new Vue({
el: '#app',
router,
i18n,
store,
render: h => h(App)
})
// add-xy start
// 国际化开发3.调用接口异步获取语言文件增加api文件
fetchMessages(currentLocale).then(messages => {
// 将获取到的消息设置到i18n实例
i18n.setLocaleMessage(currentLocale, messages.content)
// 设置当前语言
i18n.locale = currentLocale
})