index.tsx 958 Bytes
import { Link, history } from 'umi';
import { Result, Button } from 'antd';
import { HomeOutlined, ArrowLeftOutlined } from '@ant-design/icons';

type ExceptionPageProps = {
  showGoBackLink?: boolean;
  buttons?: any;
};
export default (props: ExceptionPageProps) => (
  <Result
    status="404"
    title="404"
    style={{
      background: 'none',
    }}
    subTitle="很抱歉,您访问的页面不存在或您已无权限。"
    extra={
      <>
        {typeof props.showGoBackLink === 'undefined' || props.showGoBackLink ? (
          <Button
            type="primary"
            onClick={() => {
              history.goBack();
            }}
          >
            <ArrowLeftOutlined />
            返回上一页
          </Button>
        ) : null}
        &nbsp;
        {props.buttons}
        <Link to="/">
          <Button>
            <HomeOutlined />
            首页
          </Button>
        </Link>
      </>
    }
  />
);