state = {
data: {}
}
componentWillMount () {
this.getTask('10-24', 'A')
}
#### getTask 方法 打印数据 ####
getTask = (id, bucked) => {
apis.getTask(id, bucked)
.then(data => console.log(data))
.catch(err => console.info(err))
}

getTask = (id, bucked) => {
apis.getTask(id, bucked)
.then(data => this.setState({data}))
.catch(err => console.info(err))
}

console.log(this.state.data)
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
代码本身没有问题,格式差,犯了一个低级错误.