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.

97 lines
2.5 KiB

3 years ago
import Vue from 'vue'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
3 years ago
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'
3 years ago
import adaptive from './directive/el-table'
import vueqr from 'vue-qr'
import JSONView from 'vue-json-viewer'
import { checkPermission } from './utils/permission'
import Cookies from 'js-cookie'
Vue.use(JSONView)
Vue.use(permission)
3 years ago
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,
size: Cookies.get('size') || 'small' // set element-ui default size
})
3 years ago
// 全局的常量
Vue.prototype.checkPermission = checkPermission
3 years ago
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]
3 years ago
})
new Vue({
el: '#app',
router,
store,
components: { App },
template: '<App/>',
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)
// }
})