A6statistics.ts 547 B

12345678910111213141516171819202122232425
  1. import { A6ListType } from '@/pages/A6statistics/data'
  2. // 初始化状态
  3. const initState = {
  4. // 列表数据
  5. info: { list: [], flag: false } as { list: A6ListType[]; flag: boolean }
  6. }
  7. // 定义 action 类型
  8. type Props = {
  9. type: 'A6/getInfo'
  10. payload: { list: A6ListType[]; flag: boolean }
  11. }
  12. // reducer
  13. export default function userReducer(state = initState, action: Props) {
  14. switch (action.type) {
  15. // 获取列表数据
  16. case 'A6/getInfo':
  17. return { ...state, info: action.payload }
  18. default:
  19. return state
  20. }
  21. }