fix: 修正tabs特定场景下,切换标签页报错问题;对应issue#9544

This commit is contained in:
wangfanghua 2024-01-29 14:00:09 +08:00
parent 5115bc73fa
commit a25e96af87

View File

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