main.js 1.6 KB

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