Ben Lin
2024-10-22 78999ce1626d2a786f3a705281eeba79c2f1d6dd
1
2
3
4
5
6
7
8
9
10
11
12
import type { VNode } from 'vue';
import { h } from 'vue';
import { isString } from 'lodash-es';
import Icon from '@/components/Icon/Icon.vue';
 
export const TreeIcon = ({ icon }: { icon: VNode | string | undefined }) => {
  if (!icon) return null;
  if (isString(icon)) {
    return h(Icon, { icon, class: 'mr-2' });
  }
  return h(Icon);
};