基于umi的开发模板

index.tsx 987B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import React from 'react';
  2. import { Link } from 'react-router-dom';
  3. import { connect } from 'dva';
  4. import { PageProps } from '@/utils/types/interface';
  5. import { GameModalController } from '@/utils/logic_tools/GameModal/game_modal';
  6. import styles from './index.less';
  7. class Main extends React.Component<PageProps> {
  8. state = {}
  9. componentDidMount() {
  10. const { dispatch } = this.props;
  11. dispatch({
  12. type: 'global/add'
  13. })
  14. }
  15. getDerivedStateFromProps(props: PageProps, state: any) {
  16. }
  17. render() {
  18. const { global } = this.props;
  19. return (
  20. <div className={styles.normal}>
  21. <Link to="/rank">
  22. main{global.count}
  23. </Link>
  24. <div
  25. onClick={() => {
  26. GameModalController.showPauseModal({
  27. content: '123',
  28. okText: 'ok',
  29. });
  30. }}
  31. >
  32. Modal
  33. </div>
  34. </div>
  35. );
  36. }
  37. }
  38. export default connect(({ global }: any) => ({ global }))(Main);