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 '@/styles/index.scss' // global css import App from './App' import router from './router' import store from './store' import '@/icons' // icon import '@/permission' // 权限 import { default as api } from './utils/api' import validate from './utils/validate' import { default as tableJs } from '@/utils/table' import common from './utils/common' import calculate from './utils/calculate' import apibjd from './utils/apibjd' import apisjse from './utils/apisjse' import preview from './utils/preview' import server from './utils/server' import formatter from './utils/formatter' import numToChinese from './utils/numberToChinese' import service from './service' import permission from './directive/permission' import adaptive from './directive/el-table' import vueqr from 'vue-qr' import JSONView from 'vue-json-viewer' import { checkPermission } from './utils/permission' Vue.use(JSONView) Vue.use(permission) Vue.use(adaptive) Vue.use(vueqr) import { CellGroup, Field, Loading, Tabbar, TabbarItem, Tab, Tabs, Cell, Col } from 'vant' Vue.use(Tab) Vue.use(Tabs) Vue.use(Field) Vue.use(Loading) Vue.use(Tabbar) Vue.use(TabbarItem) Vue.use(CellGroup) Vue.use(Cell) Vue.use(Col) Vue.use(ElementUI, { locale }) // 全局的常量 Vue.prototype.checkPermission = checkPermission Vue.prototype.api = api Vue.prototype.apibjd = apibjd Vue.prototype.apisjse = apisjse Vue.prototype.preview = preview Vue.prototype.server = server Vue.prototype.tableJs = tableJs Vue.prototype.common = common Vue.prototype.calculate = calculate Vue.prototype.formatter = formatter Vue.prototype.numToChinese = numToChinese Object.keys(validate).forEach(key => { Vue.prototype[key] = validate[key] }) Object.keys(service).forEach(key => { Vue.prototype[key] = service[key] }) new Vue({ el: '#app', router, store, components: { App }, template: '', render: h => h(App) }) window.addEventListener('visibilitychange', function() { // 这个方法是监测浏览器窗口发生变化的时候执行 // if (document.hidden === false && (global.it + '') !== (getTokenId() + '')) { // global.it = getTokenId() // 只有当初始创建的aaa不等于localStorage里面的userId的时候去覆盖掉这个aaa // router.go(0) // } })