main.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. // 友盟
  9. import Uma from './plugins/uma'
  10. // 公共组件 全局组件
  11. import { msg, modal, prePage, boundingClientRect } from './utils/util'
  12. import cuCustom from './components/cm-custom/cu-custom.vue'
  13. import auCustom from './components/cm-custom/au-custom.vue'
  14. import cmCustom from './components/cm-custom/cm-custom.vue'
  15. import scrollTop from '@/components/cm-module/scrollTop/scrollTop.vue'
  16. import CityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue' //全局注册地址组件
  17. Vue.component('cu-custom', cuCustom)
  18. Vue.component('au-custom', auCustom)
  19. Vue.component('cm-custom', cmCustom)
  20. Vue.component('scroll-top', scrollTop)
  21. Vue.component('city-Picker', CityPicker)
  22. Vue.prototype.$getStorage = function(key) {
  23. var userParam = uni.getStorageSync(key)
  24. if (userParam != null && userParam != '' && userParam != undefined) {
  25. return userParam
  26. } else {
  27. return null
  28. }
  29. }
  30. // 格式化时间
  31. Vue.filter('dateFormat', function(value) {
  32. if (!value) return '未知'
  33. if (value instanceof Date) {
  34. return dateFormat(value, 'yyyy-MM-dd')
  35. } else {
  36. value = new Date(value)
  37. return dateFormat(value, 'yyyy-MM-dd')
  38. }
  39. })
  40. // Vue实例化
  41. Vue.config.productionTip = false
  42. Vue.prototype.$fire = new Vue()
  43. Vue.prototype.$store = store
  44. Vue.prototype.$util = { msg, prePage, modal, boundingClientRect }
  45. Vue.prototype.$api = Api
  46. Vue.prototype.$reg = Regs
  47. Vue.prototype.$Static = 'https://static.caimei365.com/app/img/'
  48. App.mpType = 'app'
  49. // 使用插件
  50. Vue.use(Uma)
  51. const app = new Vue({
  52. ...App
  53. })
  54. app.$mount()