这个错误是哪里有问题呢,大家帮我看看吧
Warning: setState(…): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the CustomerBox component.
export default class CustomerBox extends Component{
constructor(){
super();
this.state = {
url: rootPath + "/mobile/crm/customer/list?callback=?",
todolist: null,
alltodolist: [],
loading: true,
error: null,
data: null,
generatedCount: 1,
};
}
componentWillMount(){
this.repoList = $.getJSON(this.state.url).then(
value => {
if(localStorage.getItem('customerList') == '' || localStorage.getItem('customerList') == null){
this.setState({loading: false, data: value, todolist: value.data.customerList});
localStorage.setItem('customerList', JSON.stringify(value));
}else{
this.setState({loading: false, data: JSON.parse(localStorage.getItem('customerList')), todolist: JSON.parse(localStorage.getItem('customerList')).data.customerList});
}
},
error => this.setState({loading: false, error: error})
);
}
render() {
return (
<div className="AppBox">
<div className="box">
<CustomerHeader />
<div className="mui-content edit-content content" id="content" style={{"paddingTop": immersed,"height": immersed + 45 + "px"}}>
</div>
</div>
</div>
)
}
}