Rodney Chen
2024-05-09 8e6de8cc5b7cb2c23133c1bb1a8860e2260a215a
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;
};