index.tsx 835 B

123456789101112131415161718192021222324252627282930
  1. import history, { toHomeFu } from '@/utils/history'
  2. import { Button, Result } from 'antd'
  3. import { useEffect, useRef } from 'react'
  4. export default function NotFound() {
  5. const timeRef = useRef(-1)
  6. useEffect(() => {
  7. timeRef.current = window.setTimeout(() => {
  8. const dom: HTMLDivElement = document.querySelector('.noFindPage')!
  9. dom.style.opacity = '1'
  10. }, 300)
  11. return () => {
  12. clearTimeout(timeRef.current)
  13. }
  14. }, [])
  15. return (
  16. <div className='noFindPage'>
  17. <Result status='404' title='404' subTitle='找不到页面' />
  18. <div style={{ display: 'flex', justifyContent: 'center' }}>
  19. <Button type='primary' onClick={() => toHomeFu()}>
  20. 首页
  21. </Button>
  22. &emsp;
  23. <Button onClick={() => history.go(-1)}>返回</Button>
  24. </div>
  25. </div>
  26. )
  27. }