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

View File

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