health.tsx 851 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { createSlice } from "@reduxjs/toolkit";
  2. interface HealthState {
  3. windows: any;
  4. mode: string;
  5. selTab: number;
  6. refreshs: any; //刷新数据时间点
  7. }
  8. const initialState: HealthState = {
  9. windows: null,
  10. mode: 'DAY',
  11. selTab: 0,
  12. refreshs: []
  13. }
  14. const healthSlice = createSlice({
  15. name: 'health',
  16. initialState,
  17. reducers: {
  18. setWindows(state, action) {
  19. state.windows = action.payload
  20. },
  21. setMode(state, action) {
  22. state.mode = action.payload
  23. },
  24. setTab(state, action) {
  25. state.selTab = action.payload
  26. },
  27. setRefreshs(state, action) {
  28. state.refreshs = action.payload
  29. }
  30. }
  31. })
  32. export const { setWindows, setMode, setTab, setRefreshs } = healthSlice.actions;
  33. export default healthSlice.reducer;