main.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // The Vue build version to load with the `import` command
  2. // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
  3. import Vue from 'vue'
  4. import App from './App'
  5. import router from './router'
  6. import ElementUI from 'element-ui';
  7. import 'element-ui/lib/theme-chalk/index.css';
  8. import './assets/icon/iconfont.css'
  9. import store from './store/index.js';
  10. import VueTypedJs from 'vue-typed-js'
  11. Vue.use(VueTypedJs)
  12. import axios from 'axios';
  13. axios.defaults.baseURL = 'http://132.232.92.186:8888';
  14. // axios.defaults.baseURL = 'http://localhost:5256/';
  15. import { Message } from "element-ui";
  16. import common from './assets/js/common'
  17. Vue.use(common);
  18. Vue.prototype.$message = Message
  19. Vue.prototype.$axios = axios;
  20. Vue.config.productionTip = false
  21. Vue.use(ElementUI);
  22. Vue.prototype.dateFormat = function (time) {
  23. var date = new Date(time);
  24. var year = date.getFullYear();
  25. /* 在日期格式中,月份是从0开始的,因此要加0
  26. * 使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
  27. * */
  28. var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  29. var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  30. var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  31. var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  32. var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  33. // 拼接
  34. return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
  35. };
  36. /* eslint-disable no-new */
  37. new Vue({
  38. el: '#app',
  39. router,
  40. store,
  41. components: { App },
  42. template: '<App/>'
  43. })