index.ts 437 B

123456789101112131415161718192021222324
  1. import { h } from 'vue';
  2. import { NIcon } from 'naive-ui';
  3. /**
  4. * * 生成一个用不重复的ID
  5. * @param { Number } randomLength
  6. */
  7. export function getUUID(randomLength: number) {
  8. return Number(
  9. Math.random()
  10. .toString()
  11. .substr(2, randomLength) + Date.now()
  12. ).toString(36);
  13. }
  14. /**
  15. * * render 图标
  16. */
  17. export const renderIcon = (icon: any) => {
  18. return () => h(NIcon, null, { default: () => h(icon) });
  19. }