main.js 1.49 KB
/*
 * @Descripttion:
 * @version:
 * @Author: limin
 * @Date: 2021-06-07 14:12:32
 * @LastEditors: limin
 * @LastEditTime: 2021-06-29 15:35:47
 */
// 兼容 IE
// https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#babelpolyfill
// import 'core-js/stable'
// import 'regenerator-runtime/runtime'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import api from './api'
import { fetchConfig, cfg } from '@/config'
import { axsinit } from './plugins/axios'
import '@/assets/css/index.scss'
import { bus, tools, store as local } from './utils'
import './utils/util'
import 'components'
import { components } from '@/plugins/vant'
import { HTTP } from 'glsx-common'
components.forEach(component => Vue.use(component))
Vue.prototype.api = api
Vue.prototype.bus = bus
Vue.prototype.tools = tools
Vue.prototype.local = local
Vue.prototype.to = function(name, params) {
    if (name === -1) {
      router.go(-1)
      return
    }
    router.push({ name, params })
  }
  // 移动端适配 rem
  // import 'lib-flexible/flexible.js'

Vue.config.productionTip = false

// import VConsole from 'vconsole'
// const vConsole = new VConsole()

const isMock = true
fetchConfig(!isMock).then(res => {
  // 从配置服务器获取动态配置
  // 设置 js中可以访问 $cdn
  Vue.use(cfg)
  window.$Http = new HTTP({...res })
  window.vm = new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App)
  })
})