Skip to content

Commit

Permalink
use dva-immer
Browse files Browse the repository at this point in the history
  • Loading branch information
superlbr committed Sep 15, 2018
1 parent d58b6ce commit 03a23ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .umirc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
// https://umijs.org/plugin/umi-plugin-react.html
'umi-plugin-react',
{
dva: true,
dva: { immer: true },
antd: true,
dynamicImport: true,
routes: {
Expand Down
20 changes: 4 additions & 16 deletions src/models/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,32 +156,20 @@ export default {

switchSider(state) {
window.localStorage.setItem(`${prefix}siderFold`, !state.siderFold)
return {
...state,
siderFold: !state.siderFold,
}
state.siderFold = !state.siderFold
},

switchTheme(state) {
window.localStorage.setItem(`${prefix}darkTheme`, !state.darkTheme)
return {
...state,
darkTheme: !state.darkTheme,
}
state.darkTheme = !state.darkTheme
},

switchMenuPopver(state) {
return {
...state,
menuPopoverVisible: !state.menuPopoverVisible,
}
state.menuPopoverVisible = !state.menuPopoverVisible
},

handleNavbar(state, { payload }) {
return {
...state,
isNavbar: payload,
}
state.isNavbar = payload
},

handleNavOpenKeys(state, { payload: navOpenKeys }) {
Expand Down

0 comments on commit 03a23ba

Please sign in to comment.