跳转路由前做判断,决定是否跳转
this.context.router.setRouteLeaveHook(
this.props.route,
()=> {
if (this.state.uploadFinish === false) {
return '上传未完成,确认退出?';
}
})
声明类型:
Uploading.contextTypes = {
router: React.PropTypes.object
}
网友评论