main.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 axios from 'axios';
  11. //axios.defaults.baseURL = 'http://132.232.92.186:8888';
  12. axios.defaults.baseURL = 'http://localhost:5256/';
  13. import { Message } from "element-ui";
  14. Vue.prototype.$message = Message
  15. Vue.prototype.$axios = axios;
  16. Vue.config.productionTip = false
  17. Vue.use(ElementUI);
  18. Vue.prototype.dateFormat = function (time) {
  19. var date = new Date(time);
  20. var year = date.getFullYear();
  21. /* 在日期格式中,月份是从0开始的,因此要加0
  22. * 使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
  23. * */
  24. var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  25. var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  26. var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  27. var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  28. var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  29. // 拼接
  30. return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
  31. };
  32. /* eslint-disable no-new */
  33. new Vue({
  34. el: '#app',
  35. router,
  36. store,
  37. components: { App },
  38. template: '<App/>'
  39. })