main.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import 'babel-polyfill'
  2. import Vue from 'vue'
  3. import App from './App'
  4. import router from './router'
  5. import vuex from 'vuex'
  6. import axios from './util/http.js'
  7. Vue.prototype.$http = axios
  8. Vue.prototype.$cdn = 'https://4dscene.4dage.com/new4dkk/'
  9. Vue.use(vuex)
  10. Vue.prototype.$bus = new Vue()
  11. Vue.config.productionTip = false
  12. function dateFtt (fmt) {
  13. let date = this
  14. let o = {
  15. 'M+': date.getMonth() + 1,
  16. 'd+': date.getDate(),
  17. 'h+': date.getHours(),
  18. 'm+': date.getMinutes(),
  19. 's+': date.getSeconds(),
  20. 'q+': Math.floor((date.getMonth() + 3) / 3),
  21. 'S': date.getMilliseconds()
  22. }
  23. if (/(y+)/.test(fmt)) {
  24. fmt = fmt.replace(
  25. RegExp.$1,
  26. (date.getFullYear() + '').substr(4 - RegExp.$1.length)
  27. )
  28. }
  29. for (let k in o) {
  30. if (new RegExp('(' + k + ')').test(fmt)) {
  31. fmt = fmt.replace(
  32. RegExp.$1,
  33. RegExp.$1.length === 1
  34. ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
  35. )
  36. }
  37. }
  38. return fmt
  39. }
  40. /* eslint-disable */
  41. Date.prototype.format = dateFtt
  42. /* eslint-enable */
  43. /* eslint-disable no-new */
  44. new Vue({
  45. el: '#app',
  46. router,
  47. store: require('./store').default,
  48. components: { App },
  49. template: '<App/>'
  50. })