()
| 30 | } |
| 31 | |
| 32 | render(): ReactNode { |
| 33 | if (this.state.hasError) { |
| 34 | if (this.props.fallback) { |
| 35 | return this.props.fallback |
| 36 | } |
| 37 | |
| 38 | return ( |
| 39 | <Result |
| 40 | status="error" |
| 41 | title="出错了" |
| 42 | subTitle={this.state.error?.message || '应用发生了未知错误'} |
| 43 | extra={ |
| 44 | <Button type="primary" onClick={this.handleReload}> |
| 45 | 重新加载 |
| 46 | </Button> |
| 47 | } |
| 48 | /> |
| 49 | ) |
| 50 | } |
| 51 | |
| 52 | return this.props.children |
| 53 | } |
| 54 | } |