diff --git a/src/components/Layout/Header.jsx b/src/components/Layout/Header.jsx
index 369041e..0d894c8 100644
--- a/src/components/Layout/Header.jsx
+++ b/src/components/Layout/Header.jsx
@@ -5,9 +5,8 @@ import styles from './main.less'
const SubMenu = Menu.SubMenu
-function Header({ location, user, logout }) {
+function Header({ location, user, logout, switchSider }) {
let handleClickMenu = e => e.key === 'logout' && logout()
- let switchSider = () => {}
return (
diff --git a/src/components/layout/main.less b/src/components/layout/main.less
index aa5df82..6986730 100644
--- a/src/components/layout/main.less
+++ b/src/components/layout/main.less
@@ -7,9 +7,10 @@
&.fold{
.sider{
- width: 42px;
+ // width: 42px;
+ transform: translateX(-182px);
.logo{
- margin: 4px 0;
+ // margin: 4px 0;
img{
width: 28px;
margin: 6px 7px;
@@ -49,12 +50,13 @@
.sider {
width: 224px;
+ transform: translateX(0);
background: #404040;
position: absolute;
overflow: visible;
padding-bottom: 24px;
height: 100vh;
- transition: all 0.3s ease;
+ transition: @transition-ease-in;
.logo {
text-align: center;
@@ -113,7 +115,7 @@
.main {
margin-left: 224px;
- transition: all 0.3s ease;
+ transition: @transition-ease-in;
overflow: auto;
height: 100vh;
diff --git a/src/models/app.js b/src/models/app.js
index bf7c8dd..16fc29b 100644
--- a/src/models/app.js
+++ b/src/models/app.js
@@ -62,6 +62,13 @@ export default {
type: 'logoutSuccess'
})
}
+ },
+ *switchSider({
+ payload
+ }, {put}) {
+ yield put({
+ type: 'switchSider'
+ })
}
},
reducers : {
@@ -103,6 +110,12 @@ export default {
...state,
loading: false
}
+ },
+ switchSider(state) {
+ return {
+ ...state,
+ siderFold: !state.siderFold
+ }
}
}
}
diff --git a/src/routes/app.js b/src/routes/app.js
index e61e12a..654e839 100644
--- a/src/routes/app.js
+++ b/src/routes/app.js
@@ -25,6 +25,9 @@ function App({children, location, dispatch, app}) {
location,
logout() {
dispatch({type: 'app/logout'})
+ },
+ switchSider() {
+ dispatch({type: 'app/switchSider'})
}
}