registerThirdComp.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import type { App } from 'vue';
  2. import { registerJVxeTable } from '/@/components/jeecg/JVxeTable';
  3. import { registerJVxeCustom } from '/@/components/JVxeCustom';
  4. // 注册全局dayjs
  5. import dayjs from 'dayjs';
  6. import relativeTime from 'dayjs/plugin/relativeTime';
  7. import customParseFormat from 'dayjs/plugin/customParseFormat';
  8. import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  9. export async function registerThirdComp(app: App) {
  10. //---------------------------------------------------------------------
  11. // 注册 JVxeTable 组件
  12. registerJVxeTable(app);
  13. // 注册 JVxeTable 自定义组件
  14. await registerJVxeCustom();
  15. //---------------------------------------------------------------------
  16. // 注册全局聊天表情包
  17. // update-begin--author:liaozhiyang---date:20240308---for:【QQYUN-8241】emoji-mart-vue-fast库异步加载
  18. app.component(
  19. 'Picker',
  20. createAsyncComponent(() => {
  21. return new Promise((resolve, rejected) => {
  22. import('emoji-mart-vue-fast/src')
  23. .then((res) => {
  24. const { Picker } = res;
  25. resolve(Picker);
  26. })
  27. .catch((err) => {
  28. rejected(err);
  29. });
  30. });
  31. })
  32. );
  33. // update-end--author:liaozhiyang---date:20240308---for:【QQYUN-8241】emoji-mart-vue-fast库异步加载
  34. //---------------------------------------------------------------------
  35. // 注册全局dayjs
  36. dayjs.locale('zh-cn');
  37. dayjs.extend(relativeTime);
  38. dayjs.extend(customParseFormat);
  39. app.config.globalProperties.$dayjs = dayjs
  40. app.provide('$dayjs', dayjs)
  41. //---------------------------------------------------------------------
  42. }