Skip to content

Commit db2e359

Browse files
authored
fix: opt group label (#3868)
1 parent ad3aaec commit db2e359

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

components/vc-select/utils/legacyUtil.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,18 @@ export function convertChildrenToData(
3737
props,
3838
} = node as VNode & {
3939
type: { isSelectOptGroup?: boolean };
40-
children: { default?: () => any };
40+
children: { default?: () => any; label?: () => any };
4141
};
4242

4343
if (optionOnly || !isSelectOptGroup) {
4444
return convertNodeToOption(node);
4545
}
4646
const child = children && children.default ? children.default() : undefined;
47+
const label = props?.label || children.label?.() || key;
4748
return {
4849
key: `__RC_SELECT_GRP__${key === null ? index : key}__`,
49-
label: key,
5050
...props,
51+
label,
5152
options: convertChildrenToData(child || []),
5253
} as any;
5354
})

0 commit comments

Comments
 (0)