项目中遇到一个问题,render里调用了showAccountsService方法,导致getDeligentCustomerAbility里面的接口和getStatus定义的接口一直执行,导致卡死。
class Feature extends React.PureComponent {
getDeligentCustomerStatus = async () => {
const {changeId, customerAbility} = this.props;
const ablityData = await getDeligentCustomerAbility();
const {panel, customerStatus} = await getStatus({
changeId,
changeType: customerAbility[0].changeType,
panel: 3
});
this.setState({
panel,
buttonStatus: customerStatus === 1,
customerAbility: ablityData,
});
};
showAccountsService = () => {
const {changeType, ability, changeForm} = this.props;
const isDeligentCustomerShow = changeType === 1
&& changeForm && changeForm.indexOf('1') > -1;
if (isDeligentCustomerShow) {
this.getDeligentCustomerStatus();
}
retu