main.js 944 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // main.js(Vue 2)
  2. import Vue from 'vue'
  3. import App from './App'
  4. import * as filters from './utils/filters.js'
  5. import store from './store'
  6. import uView from 'uview-ui'
  7. import config from '@/config/config'
  8. import JessibucaPlugin from './utils/jessibuca-plugin'
  9. // 注册全局过滤器
  10. Object.keys(filters).forEach((key) => {
  11. Vue.filter(key, filters[key])
  12. })
  13. // 全局挂载变量(通过 Vue.prototype)
  14. // Vue.prototype.$mainColor = config.mainColor
  15. // Vue.prototype.$lightColor = config.lightColor
  16. // Vue.prototype.$aiderLightColor = config.aiderLightColor
  17. // 使用 Vuex store
  18. Vue.use(store)
  19. // 使用 uView UI
  20. Vue.use(uView)
  21. // 动态加载 Jessibuca 插件,仅限 H5
  22. // #ifdef H5
  23. if (typeof window !== 'undefined') {
  24. Vue.use(JessibucaPlugin)
  25. }
  26. // #endif
  27. Vue.config.productionTip = false
  28. App.mpType = 'app'
  29. const app = new Vue({
  30. store,
  31. ...App
  32. })
  33. app.$mount() // 必须是这样写,不要在这里指定挂载节点