You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.8 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. import Vue from "vue";
  2. import App from "./App.vue";
  3. import router from "./router";
  4. import store from "./store";
  5. import ElementUI from "element-ui";
  6. import "element-ui/lib/theme-chalk/index.css";
  7. Vue.use(ElementUI);
  8. import axios from "axios";
  9. console.log('vue',Vue.prototype)
  10. Vue.prototype.$axios = axios;
  11. import JsonExcel from "vue-json-excel"; //vue全局导入导出excel
  12. import Print from "vue-print-nb";
  13. Vue.use(Print);
  14. Vue.component("downloadExcel", JsonExcel);
  15. Vue.config.productionTip = false;
  16. // Vue.filter('format', function (date) {
  17. // var json_date = new Date(date).toJSON()
  18. // return new Date(new Date(json_date) + 8 * 3600 * 1000).toISOString().replace(/t/g, '').replace(/\.[\d]{3}Z/, '')
  19. // })
  20. Vue.directive('focus', {
  21. // 当被绑定的元素插入到 DOM 中时
  22. inserted: function (el) {
  23. // 聚焦元素
  24. el.focus()
  25. },
  26. update: function (el) {
  27. // 聚焦元素
  28. el.focus()
  29. }
  30. })
  31. Vue.filter("dateFormat", (dataStr) => {
  32. var time = new Date(dataStr);
  33. function timeAdd0(str) {
  34. if (str < 10) {
  35. str = "0" + str;
  36. }
  37. return str;
  38. }
  39. var y = time.getFullYear();
  40. var m = time.getMonth() + 1;
  41. var d = time.getDate();
  42. var h = time.getHours();
  43. var mm = time.getMinutes();
  44. var s = time.getSeconds();
  45. return (
  46. y +
  47. "-" +
  48. timeAdd0(m) +
  49. "-" +
  50. timeAdd0(d) +
  51. " " +
  52. timeAdd0(h) +
  53. ":" +
  54. timeAdd0(mm) +
  55. ":" +
  56. timeAdd0(s)
  57. );
  58. });
  59. new Vue({
  60. router,
  61. store,
  62. render: (h) => h(App),
  63. }).$mount("#app");
  64. //监听页面大小改变
  65. window.addEventListener('resize', onResize);
  66. function onResize() {
  67. //console.log(document.body.clientHeight,'-document.body.clientHeight-',window.innerHeight)
  68. store.commit('setData', { key: 'window.pageHeight', value: window.innerHeight})
  69. store.commit('setData', { key: 'window.pageWidth', value: window.innerWidth})
  70. }
  71. onResize();