Merge pull request #11080 from allenve/fix-tabs-defaultActiveKey

fix: tabs activeKey 失效
This commit is contained in:
Allen 2024-10-21 14:02:32 +08:00 committed by GitHub
commit 9597f79764
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -271,10 +271,10 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
? resolveVariableAndFilter(props.defaultKey, props.data) ? resolveVariableAndFilter(props.defaultKey, props.data)
: props.defaultKey; : props.defaultKey;
} else if (props.defaultActiveKey) { } else if (props.defaultActiveKey) {
activeKey = resolveVariableAndFilter( activeKey =
props.defaultActiveKey, typeof props.defaultActiveKey === 'string'
props.data ? resolveVariableAndFilter(props.defaultActiveKey, props.data)
); : props.defaultActiveKey;
} }
activeKey = activeKey || (tabs[0] && tabs[0].hash) || 0; activeKey = activeKey || (tabs[0] && tabs[0].hash) || 0;