main.js 1004 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import Vue from 'vue'
  2. import App from './App'
  3. import store from '@/store/index'
  4. import request from '@/common/request'
  5. import util from '@/common/util.js';
  6. import {
  7. imgHost
  8. } from '@/common/env';
  9. import uView from "uview-ui";
  10. Vue.use(uView);
  11. Vue.config.productionTip = false;
  12. //挂载全局对象
  13. //Vue.prototype.$store = store
  14. Vue.prototype.$request = request
  15. Vue.prototype.$util = util
  16. Vue.prototype.$imgHost = imgHost
  17. // 引入colorUI
  18. Vue.config.productionTip = false
  19. App.mpType = 'app'
  20. const app = new Vue({
  21. store,
  22. request,
  23. ...App
  24. })
  25. app.$mount()
  26. Vue.prototype.formatDate = function(t) {
  27. t = t || Date.now();
  28. let time = new Date(t);
  29. let str = time.getFullYear()
  30. str += '-'
  31. str += time.getMonth() < 9 ? ('0' + (time.getMonth() + 1)) : (time.getMonth() + 1);
  32. str += '-';
  33. str += time.getDate() < 10 ? ('0' + time.getDate()) : time.getDate();
  34. str += ' ';
  35. str += time.getHours();
  36. str += ':';
  37. str += time.getMinutes() < 10 ? ('0' + time.getMinutes()) : time.getMinutes();
  38. return str;
  39. }