registerThirdComp.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import type { App } from 'vue';
  2. import { registerJVxeTable } from '/@/components/jeecg/JVxeTable';
  3. import { registerJVxeCustom } from '/@/components/JVxeCustom';
  4. // 注册全局聊天表情包
  5. import { Picker } from 'emoji-mart-vue-fast/src';
  6. import { EmojiIndex } from "emoji-mart-vue-fast/src";
  7. import data from "emoji-mart-vue-fast/data/apple.json";
  8. // 注册全局dayjs
  9. import dayjs from 'dayjs';
  10. import relativeTime from 'dayjs/plugin/relativeTime';
  11. import customParseFormat from 'dayjs/plugin/customParseFormat';
  12. export async function registerThirdComp(app: App) {
  13. // 注册 JVxeTable 组件
  14. registerJVxeTable(app);
  15. // 注册 JVxeTable 自定义组件
  16. await registerJVxeCustom();
  17. //---------------------------------------------------------------------
  18. // 注册全局聊天表情包
  19. app.component('Picker', Picker);
  20. let myEmojiIndex = new EmojiIndex(data, {
  21. function() {
  22. return true;
  23. },
  24. exclude:['recent','people','nature','foods','activity','places','objects','symbols','flags']
  25. });
  26. app.config.globalProperties.$globalEmojiIndex = myEmojiIndex
  27. app.provide('$globalEmojiIndex', myEmojiIndex)
  28. //---------------------------------------------------------------------
  29. // 注册全局dayjs
  30. dayjs.locale('zh-cn');
  31. dayjs.extend(relativeTime);
  32. dayjs.extend(customParseFormat);
  33. app.config.globalProperties.$dayjs = dayjs
  34. app.provide('$dayjs', dayjs)
  35. //---------------------------------------------------------------------
  36. }