未验证 提交 3f91f80e 编写于 作者: N Nat Welch 提交者: Joe Haddad

Allow passing of title to default error page (#7381)

* Allow passing of title to default error page

* Update README to include Error#title information

* Change title init location

* Update _error.js
上级 0cd2732c
......@@ -1398,7 +1398,9 @@ class Page extends React.Component {
export default Page
```
> If you have created a custom error page you have to import your own `_error` component from `./_error` instead of `next/error`
> If you have created a custom error page you have to import your own `_error` component from `./_error` instead of `next/error`.
The Error module also takes `title` as a property if you want to pass in message text along with a `statusCode`.
### Custom configuration
......
......@@ -27,7 +27,7 @@ export default class Error<P = {}> extends React.Component<P & ErrorProps> {
render() {
const { statusCode } = this.props
const title = statusCodes[statusCode] || 'An unexpected error has occurred'
const title = this.props.title || statusCodes[statusCode] || 'An unexpected error has occurred'
return (
<div style={styles.error}>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册