Fork me on GitHub

一个装作异步的代码段

// 获取当前周期
getCurrentCycle(subDepartmentId=this.props.subDepartmentId) {

let { dispatch } = this.props

calculateApi.currentKaoqinCycle({id:subDepartmentId}).then(res=>{
if (res.data.id) {
//console.log(res.data.name);
this.setState({
cycleName: res.data.name
})
//console.log('CYCLECYCLE',this.state.cycleName);
console.log('CYCLECYCLE',res.data.name);
}else{
this.setState({
cycleName: ''
})
}
})
}

 

posted @ 2018-02-28 16:50  思考的大腿  阅读(132)  评论(0编辑  收藏  举报