You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.7 KiB

2 years ago
import Vue from 'vue'
import Cookies from 'js-cookie'
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import ElementUI from 'element-ui'
2 years ago
// import './styles/element-variables.scss'
import 'element-ui/lib/theme-chalk/index.css'
2 years ago
import '@/styles/index.scss' // global css
import App from './App'
import store from './store'
import router from './router'
import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log
import * as filters from './filters' // global filters
import './plugins/vxe-table'
import 'xe-utils'
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'
import cal from './utils/calculation'
1 year ago
import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx'
import VXETablePluginRenderer from 'vxe-table-plugin-renderer'
import 'vxe-table-plugin-renderer/dist/style.css'
import VueSocketIO from 'vue-socket.io'
1 year ago
VXETable.use(VXETablePluginExportXLSX)
VXETable.use(VXETablePluginRenderer)
2 years ago
Vue.prototype.cal = cal
Vue.use(VXETable)
import print from './utils/print' //能不能单独引用
Vue.use(print)
// ...
String.prototype.format = function(args) {
if (arguments.length > 0) {
var result = this;
if (arguments.length == 1 && typeof(args) == "object") {
for (var key in args) {
var reg = new RegExp("({" + key + "})", "g");
result = result.replace(reg, args[key]);
}
} else {
for (var i = 0; i < arguments.length; i++) {
if (arguments[i] == undefined) {
return "";
} else {
var reg = new RegExp("({[" + i + "]})", "g");
result = result.replace(reg, arguments[i]);
}
}
}
return result;
} else {
return this;
}
}
/**
* If you don't want to use mock-server
* you want to use MockJs for mock api
* you can execute: mockXHR()
*
* Currently MockJs will be used in the production environment,
* please remove it before going online ! ! !
*/
if (process.env.NODE_ENV === 'production') {
const { mockXHR } = require('../mock')
mockXHR()
}
Vue.use(ElementUI, {
2 years ago
size: Cookies.get('size') || 'mini' // set element-ui default size
})
import dataV from '@jiaminghi/data-view'
Vue.config.productionTip = false
Vue.use(dataV)
import VueWorker from 'vue-worker' // Web worker插件
Vue.use(VueWorker)
2 years ago
// register global utility filters
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
Vue.use(new VueSocketIO({
debug: false,
connection: process.env.VUE_APP_WEBSOCKET, //
options: { autoConnect:false,path: "",transports: ['websocket', 'xhr-polling', 'jsonp-polling'], } //Optional options
}))
2 years ago
new Vue({
el: '#app',
router,
store,
render: h => h(App)
})
Vue.config.devtools = true