Scene:

1. When the pop-up layer is nested, after the second layer is popped, the first layer can still scroll and cause the second layer not to move

2. When using van-Dropdown-menu, the pop-up layer will follow the scrolling screen

Normal state:

Bug:

The solution

Dynamically set overflow: Hidden and overflow-y: scroll for the outer box

To solve the code

<view class="add-contant {{ banScroll ? 'isHidden' : ''}}"> <view class="follow-up "> <view class="f-type required-label"> Whether the key decision maker </view> <van-dropdown-menu class="follow-up-d" active-color="#1989fa"> <van-dropdown-item value="{{ is_decision_maker }}" options="{{ decisionOptions }}" bind:change="decisionChange" bind:open="openDropdown" bind:close="closeDropdown" /> </van-dropdown-menu> </view> </view>Copy the code
.add-contant {
  height: 80%;
  overflow-y: scroll;
  box-sizing: border-box;
}

.isHidden {
  overflow: hidden;
}
Copy the code
OpenDropdown () {this.setData({banScroll: true})}, closeDropdown() {this.setdata ({banScroll: false})}Copy the code