Skip to content

Commit

Permalink
fix: opt group label (#3868)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkwolf authored Mar 28, 2021
1 parent ad3aaec commit db2e359
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/vc-select/utils/legacyUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ export function convertChildrenToData(
props,
} = node as VNode & {
type: { isSelectOptGroup?: boolean };
children: { default?: () => any };
children: { default?: () => any; label?: () => any };
};

if (optionOnly || !isSelectOptGroup) {
return convertNodeToOption(node);
}
const child = children && children.default ? children.default() : undefined;
const label = props?.label || children.label?.() || key;
return {
key: `__RC_SELECT_GRP__${key === null ? index : key}__`,
label: key,
...props,
label,
options: convertChildrenToData(child || []),
} as any;
})
Expand Down

0 comments on commit db2e359

Please sign in to comment.