Ben Lin
2024-07-06 44ef538691b8be0fd925ca80c49157bad14962e8
src/components/Tree/src/TreeIcon.ts
@@ -1,12 +1,12 @@
import type { VNode, FunctionalComponent } from 'vue';
import type { VNode } 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 }) => {
export const TreeIcon = ({ icon }: { icon: VNode | string | undefined }) => {
  if (!icon) return null;
  if (isString(icon)) {
    return h(Icon, { icon, class: 'mr-1' });
    return h(Icon, { icon, class: 'mr-2' });
  }
  return Icon;
  return h(Icon);
};