diff --git a/src/components/tabPage/main.js b/src/components/tabPage/main.js index 0d2bb235..d9dfeee4 100644 --- a/src/components/tabPage/main.js +++ b/src/components/tabPage/main.js @@ -15,11 +15,7 @@ export default class tabbar extends React.Component { }; } componentDidMount() { - if (!this.props.first) { - this.tabChange(0); - } else { - this.setState({ activeIndex: 0 }); - } + this.tabChange(0); } tabChange(index) { @@ -37,7 +33,7 @@ export default class tabbar extends React.Component { arr[i] = temp; } this.setState({ tabList: arr }); - if (this.state.tabList.length > 1) { + if (this.state.tabList.length > 1 && this.props.first !== true) { this.props.tabChange(index); } }