snowy.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import * as antdvIcons from '@ant-design/icons-vue'
  2. import config from './config'
  3. import tool from './utils/tool'
  4. import { hasPerm } from './utils/permission/index'
  5. import errorHandler from './utils/errorHandler'
  6. import customIcons from './assets/icons/index.js'
  7. import 'highlight.js/styles/atom-one-dark.css'
  8. import hljsCommon from 'highlight.js/lib/common'
  9. import hljsVuePlugin from '@highlightjs/vue-plugin'
  10. import STable from './components/Table/index.vue'
  11. import Ellipsis from './components/Ellipsis/index.vue'
  12. import DragModal from './components/DragModal/index.vue'
  13. import DIYUPLoad from './components/DIYUPLoad/index.vue'
  14. import Del from './components/del/del.vue'
  15. import DELCOPY from './components/del/delcopy.vue'
  16. // import ACC from './components/del/ACC.vue'
  17. // /DELCOPY
  18. const cps = [DIYUPLoad, Del, DELCOPY]
  19. export default {
  20. install (app) {
  21. // 挂载全局对象
  22. app.config.globalProperties.$CONFIG = config
  23. app.config.globalProperties.$TOOL = tool
  24. app.config.globalProperties.hasPerm = hasPerm
  25. // 注册常用组件
  26. app.component('STable', STable)
  27. app.component('Ellipsis', Ellipsis)
  28. app.component('DragModal', DragModal)
  29. // app.component('DIYUPLoad', DIYUPLoad)
  30. cps.forEach((cp) => {
  31. app.component(cp.name, cp)
  32. })
  33. // 统一注册antdv图标
  34. for (const icon in antdvIcons) {
  35. app.component(icon, antdvIcons[icon])
  36. }
  37. // 统一注册自定义全局图标
  38. app.use(customIcons)
  39. // 注册代码高亮组件 (博客:https://blog.csdn.net/weixin_41897680/article/details/124925222)
  40. // 注意:解决Vue使用highlight.js build打包发布后样式消失问题,原因是webpack在打包的时候没有把未被使用的代码打包进去,因此,在此处引用一下,看似无意义实则有用
  41. hljsCommon.highlightAuto('<h1>Highlight.js has been registered successfully!</h1>').value
  42. app.use(hljsVuePlugin)
  43. // 全局代码错误捕捉
  44. app.config.errorHandler = errorHandler
  45. }
  46. }