main.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import Vue from 'vue'
  2. import store from './store'
  3. import App from './App'
  4. import './services/index.js'
  5. import * as Api from '@/common/config/caimeiApi.js'
  6. import * as Regs from '@/common/config/common.js'
  7. import { dateFormat } from './utils/util.js'
  8. import global from '@/mixins/global.js'
  9. import ResidenceTime from './plugins/simple-residence-time'
  10. import residence from './utils/residence.js'
  11. // 公共组件 全局组件
  12. import { msg, modal, prePage, boundingClientRect } from './utils/util'
  13. import cuCustom from './components/cm-custom/cu-custom.vue'
  14. import auCustom from './components/cm-custom/au-custom.vue'
  15. import cmCustom from './components/cm-custom/cm-custom.vue'
  16. import scrollTop from '@/components/cm-module/scrollTop/scrollTop.vue'
  17. import CityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue' //全局注册地址组件
  18. Vue.component('cu-custom', cuCustom)
  19. Vue.component('au-custom', auCustom)
  20. Vue.component('cm-custom', cmCustom)
  21. Vue.component('scroll-top', scrollTop)
  22. Vue.component('city-Picker', CityPicker)
  23. // 格式化时间
  24. Vue.filter('dateFormat', function(value) {
  25. if (!value) return '未知'
  26. if (value instanceof Date) {
  27. return dateFormat(value, 'yyyy-MM-dd')
  28. } else {
  29. value = new Date(value)
  30. return dateFormat(value, 'yyyy-MM-dd')
  31. }
  32. })
  33. // Vue实例化
  34. Vue.config.productionTip = false
  35. Vue.prototype.$fire = new Vue()
  36. Vue.prototype.$store = store
  37. Vue.prototype.$util = { msg, prePage, modal, boundingClientRect }
  38. Vue.prototype.$api = Api
  39. Vue.prototype.$reg = Regs
  40. Vue.prototype.global = global
  41. App.mpType = 'app'
  42. // 使用插件
  43. // Vue.use(ResidenceTime, residence)
  44. // 全局混入
  45. // Vue.mixin(globalMixin)
  46. const app = new Vue({
  47. ...App
  48. })
  49. app.$mount()