1) 修复优惠券列表初始化页面请求两次

This commit is contained in:
zhangds 2022-09-14 10:20:26 +08:00
parent 1ce706af15
commit b63367e30a
1 changed files with 2 additions and 6 deletions

View File

@ -15,11 +15,7 @@ export default class tabbar extends React.Component {
}; };
} }
componentDidMount() { componentDidMount() {
if (!this.props.first) { this.tabChange(0);
this.tabChange(0);
} else {
this.setState({ activeIndex: 0 });
}
} }
tabChange(index) { tabChange(index) {
@ -37,7 +33,7 @@ export default class tabbar extends React.Component {
arr[i] = temp; arr[i] = temp;
} }
this.setState({ tabList: arr }); this.setState({ tabList: arr });
if (this.state.tabList.length > 1) { if (this.state.tabList.length > 1 && this.props.first !== true) {
this.props.tabChange(index); this.props.tabChange(index);
} }
} }