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