main.js 2.1 KB

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