From b63367e30ae52067ca4c317196c37676c47276ae Mon Sep 17 00:00:00 2001 From: zhangds Date: Wed, 14 Sep 2022 10:20:26 +0800 Subject: [PATCH] =?UTF-8?q?1)=20=E4=BF=AE=E5=A4=8D=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E5=88=97=E8=A1=A8=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=AF=B7=E6=B1=82=E4=B8=A4=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/tabPage/main.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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); } }