react withRouter 离开页面触发

componentDidMount(){
this.props.router.setRouteLeaveHook(this.props.route, () => {
//if (this.state.unsaved)
return 'You have unsaved information, are you sure you want to leave this page?'
//获取通过connect包裹的对象
this.refs[''].wrappedInstance.getFieldsValue()
})
}
posted @ 2017-05-22 10:15  <张磊>  阅读(4941)  评论(0编辑  收藏  举报