| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import { createSlice } from "@reduxjs/toolkit";
- interface HealthState {
- windows: any;
- mode: string;
- selTab: number;
- refreshs: any; //刷新数据时间点
- }
- const initialState: HealthState = {
- windows: null,
- mode: 'DAY',
- selTab: 0,
- refreshs: []
- }
- const healthSlice = createSlice({
- name: 'health',
- initialState,
- reducers: {
- setWindows(state, action) {
- state.windows = action.payload
- },
- setMode(state, action) {
- state.mode = action.payload
- },
- setTab(state, action) {
- state.selTab = action.payload
- },
- setRefreshs(state, action) {
- state.refreshs = action.payload
- }
- }
- })
- export const { setWindows, setMode, setTab, setRefreshs } = healthSlice.actions;
- export default healthSlice.reducer;
|