From 344c9f74c9c5ec9006d9f59b27be9758effeebbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B4=E8=8C=82=E6=BA=90?= Date: Wed, 6 Jun 2018 10:51:53 +0800 Subject: [PATCH] fix: fixed header width (#1614) --- src/layouts/Header.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/layouts/Header.js b/src/layouts/Header.js index f3968e15..7991efc8 100644 --- a/src/layouts/Header.js +++ b/src/layouts/Header.js @@ -21,16 +21,12 @@ class HeaderView extends PureComponent { document.getElementById('root').removeEventListener('scroll', this.handScroll); } getHeadWidth = () => { - const { fixedHeader, layout, fixSiderbar } = this.props.setting; - if (!fixedHeader || layout === 'topmenu' || fixSiderbar) { + const { isMobile, collapsed, setting } = this.props; + const { fixedHeader, layout } = setting; + if (isMobile || !fixedHeader || layout === 'topmenu') { return '100%'; } - if (!this.props.collapsed) { - return 'calc(100% - 256px)'; - } - if (this.props.collapsed) { - return 'calc(100% - 80px)'; - } + return collapsed ? 'calc(100% - 80px)' : 'calc(100% - 256px)'; }; handleNoticeClear = type => { message.success(`清空了${type}`); -- GitLab