goview_vue/src/utils/index.ts
2021-12-14 16:41:43 +08:00

25 lines
437 B
TypeScript

import { h } from 'vue';
import { NIcon } from 'naive-ui';
/**
* * 生成一个用不重复的ID
* @param { Number } randomLength
*/
export function getUUID(randomLength: number) {
return Number(
Math.random()
.toString()
.substr(2, randomLength) + Date.now()
).toString(36);
}
/**
* * render 图标
*/
export const renderIcon = (icon: any) => {
return () => h(NIcon, null, { default: () => h(icon) });
}