From c6c71affd428403022b165dcec46274ae5bbf671 Mon Sep 17 00:00:00 2001 From: ULIVZ <472590061@qq.com> Date: Wed, 18 Apr 2018 11:01:06 -0500 Subject: [PATCH] feat(sidebar): support click the part outside sidebar to close the sidebar. (#132) --- lib/default-theme/Layout.vue | 1 + lib/default-theme/styles/theme.styl | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/default-theme/Layout.vue b/lib/default-theme/Layout.vue index 91ecbfea86..5423e2f0b9 100644 --- a/lib/default-theme/Layout.vue +++ b/lib/default-theme/Layout.vue @@ -4,6 +4,7 @@ @touchstart="onTouchStart" @touchend="onTouchEnd"> +
diff --git a/lib/default-theme/styles/theme.styl b/lib/default-theme/styles/theme.styl index 638b187df8..1b6c2b9328 100644 --- a/lib/default-theme/styles/theme.styl +++ b/lib/default-theme/styles/theme.styl @@ -29,6 +29,15 @@ body box-sizing border-box border-bottom 1px solid $borderColor +.sidebar-mask + position fixed + z-index 9 + top 0 + left 0 + width 100vw + height 100vh + display none + .sidebar font-size 15px background-color #fff @@ -153,11 +162,16 @@ th, td .custom-layout padding-top $navbarHeight -.theme-container.no-navbar - .content:not(.custom) - h1, h2, h3, h4, h5, h6 - margin-top 1.5rem - padding-top 0 +.theme-container + &.sidebar-open + .sidebar-mask + display: block + &.no-navbar + .content:not(.custom) + h1, h2, h3, h4, h5, h6 + margin-top 1.5rem + padding-top 0 + @media (min-width: ($MQMobile + 1px)) .theme-container.no-sidebar