From 7fc14eddd9fdb718f6fbbbcd01fd01cb428c296b Mon Sep 17 00:00:00 2001 From: Louis-7 Date: Mon, 3 Sep 2018 13:18:46 +0800 Subject: [PATCH 1/3] fix sidebar shake once mouse over it Signed-off-by: Louis-7 --- src/components/Layout/Layout.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/Layout/Layout.less b/src/components/Layout/Layout.less index 7fb56e0..bf5adc4 100644 --- a/src/components/Layout/Layout.less +++ b/src/components/Layout/Layout.less @@ -25,6 +25,11 @@ } .ant-menu { + &.ant-menu-inline { + .ant-menu-item { + width: 100%; + } + } .ant-menu-item, .ant-menu-submenu-title { overflow: hidden; From 0c95751b8d3bffa96d3162fc3c789db78be2282f Mon Sep 17 00:00:00 2001 From: Louis-7 Date: Mon, 3 Sep 2018 14:54:20 +0800 Subject: [PATCH 2/3] restrict rule Signed-off-by: Louis-7 --- src/components/Layout/Layout.less | 8 ++++++++ src/components/Layout/Menu.js | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/components/Layout/Layout.less b/src/components/Layout/Layout.less index bf5adc4..f6098ca 100644 --- a/src/components/Layout/Layout.less +++ b/src/components/Layout/Layout.less @@ -108,6 +108,14 @@ } } +.sidemenu { + :global{ + .ant-menu-item { + width: 100%; + } + } +} + .switchtheme { width: 100%; position: absolute; diff --git a/src/components/Layout/Menu.js b/src/components/Layout/Menu.js index 0ce46ab..9c0ce1e 100644 --- a/src/components/Layout/Menu.js +++ b/src/components/Layout/Menu.js @@ -4,6 +4,7 @@ import { Menu, Icon } from 'antd' import { Link } from 'react-router-dom' import { arrayToTree, queryArray } from 'utils' import pathToRegexp from 'path-to-regexp' +import styles from './Layout.less' const { SubMenu } = Menu let openKeysFlag = false @@ -123,6 +124,7 @@ const Menus = ({ mode={siderFold ? 'vertical' : 'inline'} theme={darkTheme ? 'dark' : 'light'} selectedKeys={defaultSelectedKeys} + className={styles.sidemenu} > {menuItems} From cc5c3193323ceb825eca3f22e58f62e9052c7a2b Mon Sep 17 00:00:00 2001 From: Louis-7 Date: Mon, 3 Sep 2018 14:58:56 +0800 Subject: [PATCH 3/3] remove useless rule Signed-off-by: Louis-7 --- src/components/Layout/Layout.less | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/components/Layout/Layout.less b/src/components/Layout/Layout.less index f6098ca..1580b42 100644 --- a/src/components/Layout/Layout.less +++ b/src/components/Layout/Layout.less @@ -25,11 +25,6 @@ } .ant-menu { - &.ant-menu-inline { - .ant-menu-item { - width: 100%; - } - } .ant-menu-item, .ant-menu-submenu-title { overflow: hidden;