fix: symbol error

pull/4499/head
tangjinzhou 2021-08-10 15:21:13 +08:00
parent f5849fad68
commit 08c3c9cc3b
2 changed files with 7 additions and 6 deletions

View File

@ -50,7 +50,7 @@ const Row: FunctionalComponent<RowProps> = props => {
if (typeof component === 'string') {
return (
<Cell
key={`${type}-${key || index}`}
key={`${type}-${String(key) || index}`}
class={className}
style={style}
labelStyle={{ ...rootLabelStyle.value, ...labelStyle }}
@ -68,7 +68,7 @@ const Row: FunctionalComponent<RowProps> = props => {
return [
<Cell
key={`label-${key || index}`}
key={`label-${String(key) || index}`}
class={className}
style={{ ...rootLabelStyle.value, ...style, ...labelStyle }}
span={1}
@ -79,7 +79,7 @@ const Row: FunctionalComponent<RowProps> = props => {
label={label}
/>,
<Cell
key={`content-${key || index}`}
key={`content-${String(key) || index}`}
class={className}
style={{ ...rootContentStyle.value, ...style, ...contentStyle }}
span={span * 2 - 1}

View File

@ -7,8 +7,9 @@ function convertNodeToOption(node: VNode): OptionData {
key,
children,
props: { value, disabled, ...restProps },
} = node as VNode & {
} = node as Omit<VNode, 'key'> & {
children: { default?: () => any };
key: string | number;
};
const child = children && children.default ? children.default() : undefined;
return {
@ -16,7 +17,7 @@ function convertNodeToOption(node: VNode): OptionData {
value: value !== undefined ? value : key,
children: child,
disabled: disabled || disabled === '', // support <a-select-option disabled />
...restProps,
...(restProps as Omit<typeof restProps, 'key'>),
};
}
@ -46,7 +47,7 @@ export function convertChildrenToData(
const child = children && children.default ? children.default() : undefined;
const label = props?.label || children.label?.() || key;
return {
key: `__RC_SELECT_GRP__${key === null ? index : key}__`,
key: `__RC_SELECT_GRP__${key === null ? index : String(key)}__`,
...props,
label,
options: convertChildrenToData(child || []),