修复 tabs 初始可能不显示 tab 的问题

This commit is contained in:
liaoxuezhi 2019-05-24 20:51:29 +08:00 committed by catchonme
parent dc15298c84
commit 0a2ca2a0cd
1 changed files with 8 additions and 0 deletions

View File

@ -64,6 +64,10 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
this.switchTo = this.switchTo.bind(this);
}
componentDidMount() {
this.autoJumpToNeighbour();
}
componentWillReceiveProps(nextProps: TabsProps) {
const props = this.props;
@ -107,6 +111,10 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
}
componentDidUpdate() {
this.autoJumpToNeighbour();
}
autoJumpToNeighbour() {
const {
tabs,
data