import { createSlice } from "@reduxjs/toolkit"; export const initialState = { info: { // 余热发电 elecQty1: "0", // kWh // 电消耗量 elecQty2: "0", // kWh // 水消耗量 waterQty: "0", // Km³ // 天然气1 ngQty1: "0", // m³ // 天然气2 ngQty2: "0", // m³ }, }; const energySlice = createSlice({ name: "energy", initialState, reducers: { setInfo: (state, action) => { state.info = { ...state.info, ...action.payload }; }, }, }); export default energySlice.reducer; export const { setInfo } = energySlice.actions;