Merge pull request #9545 from TigerWFH/feature_issue_tabs

fix: 修正tabs特定场景下,切换标签页报错问题;对应issue#9544
This commit is contained in:
张涛 2024-01-30 20:15:45 +08:00 committed by GitHub
commit 7a931a3901
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -388,8 +388,8 @@ export class Tabs extends React.Component<TabsProps, any> {
} }
const {activeKey, children} = this.props; const {activeKey, children} = this.props;
const currentKey = key !== undefined ? key : activeKey; const currentKey = key !== undefined ? key : activeKey;
const currentIndex = (children as any[])?.findIndex( const currentIndex = (children as any[])?.findIndex((item: any) =>
(item: any) => item.props.eventKey === currentKey item === null ? false : item.props.eventKey === currentKey
); );
const li = this.navMain.current?.children || []; const li = this.navMain.current?.children || [];
const currentLi = li[currentIndex] as HTMLElement; const currentLi = li[currentIndex] as HTMLElement;