Skip to content

Commit

Permalink
umicro#608 修复Dropdown和Sticky组合和出现页面无法滚动的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
finnlee87 committed Nov 8, 2020
1 parent a8e8f5b commit 2551cc6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions uview-ui/components/u-dropdown/u-dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
</view>
<view class="u-dropdown__content" :style="[contentStyle, {
transition: `opacity ${duration / 1000}s linear`,
top: $u.addUnit(height),
height: contentHeight + 'px'
top: $u.addUnit(height)
}]"
@tap="maskClick" @touchmove.stop.prevent>
<view @tap.stop.prevent class="u-dropdown__content__popup" :style="[popupStyle]">
Expand Down Expand Up @@ -121,7 +120,9 @@
// 外层内容的样式,初始时处于底层,且透明
contentStyle: {
zIndex: -1,
opacity: 0
opacity: 0,
// content默认高度0px
height: '0px'
},
// 让某个菜单保持高亮的状态
highlightIndex: 99999,
Expand Down Expand Up @@ -177,6 +178,8 @@
// 展开时,设置下拉内容的样式
this.contentStyle = {
zIndex: 11,
// open时设置content高度
height: this.contentHeight + 'px'
}
// 标记展开状态以及当前展开项的索引
this.active = true;
Expand All @@ -197,7 +200,9 @@
// 下拉内容的样式进行调整,不透明度设置为0
this.contentStyle = {
zIndex: -1,
opacity: 0
opacity: 0,
// close时重置content高度为0px,以免遮挡其他内容
height: '0px'
}
},
// 点击遮罩
Expand Down

0 comments on commit 2551cc6

Please sign in to comment.