main.js 1.9 KB

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