Skip to content

Commit

Permalink
fix(dropdown-menu): 修复菜单栏和面板分离问题 (#2606)
Browse files Browse the repository at this point in the history
* fix(dropdown-menu): 修复菜单栏和面板分离问题

* fix(dropdown-menu): 删除快照

* fix(dropdown-menu): 更新快照

* test: update snapshots

* feat(dropdown-menu): 收起状态允许触摸菜单栏滑动

---------

Co-authored-by: maureenwan <maureenwan@tencent.com>
Co-authored-by: anlyyao <anly_yaw@163.com>
  • Loading branch information
3 people authored Feb 27, 2024
1 parent 27a0cf7 commit cf77599
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/dropdown-item/dropdown-item.less
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,11 @@
}
}
}

&_mask {
position: fixed;
width: 100vh;
top: 0;
left: 0;
}
}
7 changes: 7 additions & 0 deletions src/dropdown-item/dropdown-item.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
class="{{classPrefix}} class {{prefix}}-class"
style="{{_._style([this.getStyles(top, zIndex), style, customStyle])}}"
>
<view
class="{{ classPrefix }}_mask"
hidden="{{!show}}"
style="{{_._style(['height:' + maskHeight + 'px', style, customStyle])}}"
bind:tap="handleMaskClick"
catchtouchmove="closeDropdown"
></view>
<t-popup
visible="{{show}}"
z-index="{{zIndex + 1}}"
Expand Down
8 changes: 8 additions & 0 deletions src/dropdown-menu/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ exports[`dropdown-menu :base 1`] = `
class="t-dropdown-menu class t-class"
id="t-bar"
style="font-size: 9px;"
catch:touchmove="noop"
>
<wx-view
ariaDisabled="{{false}}"
Expand Down Expand Up @@ -84,6 +85,13 @@ exports[`dropdown-menu :base 1`] = `
class="t-dropdown-item class t-class"
style="z-index:11600;"
>
<wx-view
class="t-dropdown-item_mask"
hidden="{{false}}"
style="height:0px;"
bind:tap="handleMaskClick"
catch:touchmove="closeDropdown"
/>
<t-popup
tClass="t-dropdown-item__popup-host"
tClassContent="t-dropdown-item__content t-class-content"
Expand Down
2 changes: 2 additions & 0 deletions src/dropdown-menu/dropdown-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,7 @@ export default class DropdownMenu extends SuperComponent {

this.toggle(index);
},

noop() {},
};
}
7 changes: 6 additions & 1 deletion src/dropdown-menu/dropdown-menu.wxml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<import src="../common/template/icon.wxml" />
<wxs src="../common/utils.wxs" module="_" />

<view style="{{_._style([style, customStyle])}}" class="{{ classPrefix }} class {{prefix}}-class" id="t-bar">
<view
style="{{_._style([style, customStyle])}}"
class="{{ classPrefix }} class {{prefix}}-class"
id="t-bar"
catchtouchmove="{{activeIdx === -1?'':'noop'}}"
>
<view
wx:for="{{menus}}"
wx:key="index"
Expand Down
1 change: 1 addition & 0 deletions src/tree-select/tree-select.less
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@

&-column {
width: 100%;
height: auto;
}
}

0 comments on commit cf77599

Please # to comment.