main.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import Vue from 'vue'
  2. import App from './App'
  3. // #ifdef H5
  4. import wx from 'weixin-jsapi'
  5. // import VConsole from 'vconsole';
  6. // new VConsole();
  7. // import eruda from 'eruda';
  8. // eruda.init();
  9. console.info('v2.4.34');
  10. Vue.prototype.wx = wx //声明扫码
  11. Vue.prototype.audios = [] //待播放的语音集合
  12. // #endif
  13. // #ifdef APP-PLUS
  14. Vue.prototype.$ws = null//websocket
  15. // #endif
  16. Vue.config.productionTip = false
  17. Date.prototype.Format = function (fmt) {
  18. var o = {
  19. "M+": this.getMonth() + 1, //月份
  20. "d+": this.getDate(), //日
  21. "h+": this.getHours(), //小时
  22. "m+": this.getMinutes(), //分
  23. "s+": this.getSeconds(), //秒
  24. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  25. S: this.getMilliseconds(), //毫秒
  26. };
  27. if (/(y+)/.test(fmt))
  28. fmt = fmt.replace(
  29. RegExp.$1,
  30. (this.getFullYear() + "").substr(4 - RegExp.$1.length)
  31. );
  32. for (var k in o)
  33. if (new RegExp("(" + k + ")").test(fmt))
  34. fmt = fmt.replace(
  35. RegExp.$1,
  36. RegExp.$1.length == 1
  37. ? o[k]
  38. : ("00" + o[k]).substr(("" + o[k]).length)
  39. );
  40. return fmt;
  41. };
  42. // 日期过滤器
  43. Vue.filter('formatDate', function(timestamp, format){
  44. console.log(timestamp, format);
  45. return new Date(timestamp).Format(format);
  46. })
  47. App.mpType = 'app'
  48. const app = new Vue({
  49. ...App
  50. })
  51. app.$mount()