import React, { createElement } from 'react'; import classNames from 'classnames'; import { Button } from 'antd'; import config from './typeConfig'; import styles from './index.less'; class Exception extends React.PureComponent { static defaultProps = { backText: 'back to home', redirect: '/', }; constructor(props) { super(props); this.state = {}; } render() { const { className, backText, linkElement = 'a', type, title, desc, img, actions, redirect, ...rest } = this.props; const pageType = type in config ? type : '404'; const clsString = classNames(styles.exception, className); return (

{title || config[pageType].title}

{desc || config[pageType].desc}
{actions || createElement( linkElement, { to: redirect, href: redirect, }, )}
); } } export default Exception;