plm前端
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.

67 lines
2.6 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
  1. import Vue from 'vue'
  2. import App from '@/App'
  3. import router from '@/router' // api: https://github.com/vuejs/vue-router
  4. import store from '@/store' // api: https://github.com/vuejs/vuex
  5. import VueCookie from 'vue-cookie' // api: https://github.com/alfhen/vue-cookie // 时间处理
  6. import dayjs from 'dayjs';
  7. import '@/element-ui' // api: https://github.com/ElemeFE/element
  8. import '@/icons' // api: http://www.iconfont.cn/
  9. import '@/element-ui-theme'
  10. import '@/assets/scss/index.scss'
  11. import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios
  12. import { isAuth } from '@/utils'
  13. import { accessField } from '@/utils'
  14. import cloneDeep from 'lodash/cloneDeep'
  15. import JsonExcel from 'vue-json-excel'
  16. import i18n from '@/i18n/i18n'
  17. import './utils/directives'
  18. import decimalUtil from '@/utils/decimalUtil.js'
  19. import getLodop from '@/utils/LodopFuncs.js'
  20. import pdf from 'vue-pdf'
  21. import { debounce,throttle} from '@/utils/common.js'
  22. import selectDiv from '@/views/common/selectDiv.vue'
  23. Vue.component('downloadExcel', JsonExcel)
  24. Vue.component('pdf', pdf)
  25. Vue.use(VueCookie)
  26. Vue.config.productionTip = false
  27. Vue.component('selectDiv', selectDiv);
  28. // 非生产环境, 适配mockjs模拟数据 // api: https://github.com/nuysoft/Mock
  29. if (process.env.NODE_ENV !== 'production') {
  30. require('@/mock')
  31. }
  32. // 挂载全局
  33. Vue.prototype.$http = httpRequest // ajax请求方法
  34. Vue.prototype.isAuth = isAuth // 权限方法
  35. Vue.prototype.accessField = accessField // 权限方法
  36. Vue.prototype.getLodop = getLodop // 打印
  37. Vue.prototype.decimalUtil = decimalUtil // 计算
  38. Vue.prototype.dayjs = dayjs //时间格式化插件 2021-11-02
  39. Vue.prototype.debounce = debounce // 防抖
  40. Vue.prototype.throttle = throttle // 限流
  41. // 保存整站vuex本地储存初始状态
  42. window.SITE_CONFIG['storeState'] = cloneDeep(store.state)
  43. /* eslint-disable no-new */
  44. new Vue({
  45. el: '#app',
  46. router,
  47. i18n,
  48. store,
  49. template: '<App/>',
  50. components: { App }
  51. })
  52. // 在Vue实例初始化之前添加全局事件监听器
  53. document.addEventListener('keydown', function(event) {
  54. // 获取触发事件的元素
  55. const targetElement = event.target;
  56. // 如果触发事件的元素是<input type="number">,并且按下的是上下箭头键
  57. if (targetElement.tagName === 'INPUT' && targetElement.type === 'number' && (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {
  58. // 阻止默认行为,取消按上下箭头键改变值的行为
  59. event.preventDefault();
  60. }
  61. });