123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- // ie polyfill
- import '@babel/polyfill'
- import Vue from 'vue'
- import App from './App.vue'
- import router from './router'
- import store from './store/'
- import { VueAxios } from './utils/request'
- import Viewer from 'v-viewer'
- import 'viewerjs/dist/viewer.css'
- import VueUeditorWrap from 'vue-ueditor-wrap'
- // mock
- // import './mock'
- import bootstrap from './core/bootstrap'
- import './core/use'
- import './permission' // permission control
- import './utils/filter' // global filter
- import BaseTool from './utils/install'
- // import echarts from 'echarts'
- import VueI18n from 'vue-i18n'
- import Print from 'vue-print-nb' // 注册
- import ChartPanel from '@/components/ChartView/index.vue'
- Vue.use(Print)
- Vue.component(ChartPanel.name, ChartPanel)
- // Vue.prototype.$echarts = echarts
- Vue.config.productionTip = false
- // mount axios Vue.$http and this.$http
- Vue.use(VueAxios)
- Vue.use(BaseTool)
- Vue.use(VueI18n) // 通过插件的形式挂载
- Vue.use(Viewer)
- Vue.component('vue-ueditor-wrap', VueUeditorWrap)
- export const eventBus = new Vue()
- Vue.prototype.$eventBus = eventBus
- Vue.directive('drag-modal', (el, bindings, vnode) => {
- Vue.nextTick(() => {
- const { visible, destroyOnClose } = vnode.componentInstance
- // 防止未定义 destroyOnClose 关闭弹窗时dom未被销毁,指令被重复调用
- if (!visible) return
- const modal = el.getElementsByClassName('ant-modal')[0]
- const header = el.getElementsByClassName('ant-modal-header')[0]
- let left = 0
- let top = 0
- // 未定义 destroyOnClose 时,dom未被销毁,关闭弹窗再次打开,弹窗会停留在上一次拖动的位置
- if (!destroyOnClose) {
- left = modal.left || 0
- top = modal.top || 0
- }
- // top 初始值为 offsetTop
- top = top || modal.offsetTop
- header.onmousedown = e => {
- const startX = e.clientX
- const startY = e.clientY
- header.left = header.offsetLeft
- header.top = header.offsetTop
- el.onmousemove = event => {
- const endX = event.clientX
- const endY = event.clientY
- modal.left = header.left + (endX - startX) + left
- modal.top = header.top + (endY - startY) + top
- modal.style.left = modal.left + 'px'
- modal.style.top = modal.top + 'px'
- }
- el.onmouseup = event => {
- left = modal.left
- top = modal.top
- el.onmousemove = null
- el.onmouseup = null
- header.releaseCapture && header.releaseCapture()
- }
- header.setCapture && header.setCapture()
- }
- })
- })
- const i18n = new VueI18n({
- // locale: localStorage.getItem('locale') || 'zh-CN',
- locale: 'zh-CN',
- messages: {
- 'zh-CN': require('./i18n/zh')
- // 'en-US': require('./i18n/en')
- }
- })
- Viewer.setDefaults({
- Options: {
- inline: true,
- button: false,
- navbar: true,
- title: true,
- toolbar: true,
- tooltip: true,
- movable: true,
- zoomable: true,
- rotatable: true,
- scalable: true,
- transition: true,
- fullscreen: true,
- keyboard: true,
- url: 'data-source'
- }
- })
- new Vue({
- i18n,
- router,
- store,
- created: bootstrap,
- render: h => h(App)
- }).$mount('#app')
|