feat: 改造

This commit is contained in:
秋水浮尘
2023-12-02 23:31:54 +08:00
parent 40e5a94d91
commit 0cb65254f4
33 changed files with 2107 additions and 332 deletions

View File

@@ -0,0 +1,28 @@
import { createSlice } from '@reduxjs/toolkit'
export interface CounterState {
value: number
title: string
}
const initialState: CounterState = {
value: 0,
title: 'redux toolkit pre'
}
// 创建一个 Slice
export const userInfoSlice = createSlice({
name: 'userInfo',
initialState,
// 定义 reducers 并生成关联的操作
reducers: {
// 定义一个加的方法
saveUserInfo: (state, { payload }) => {
state.value = payload
}
}
})
// 导出加减的方法
export const { saveUserInfo } = userInfoSlice.actions
// 默认导出
export default userInfoSlice.reducer