WeChat Mini Program prohibits the content below the pop-up box from sliding the pop-up window to prohibit the bottom content from scrolling

The problem we need to solve: When the pop-up box is displayed, the content under the pop-up box cannot be scrolled

There are a lot of pop-up boxes in small programs. As shown below, the bottom of the pop-up box is a page that can be pulled down, but when the pop-up box appears, scrolling at the bottom needs to be prohibited, so what should I do?

Insert picture description here
solution:

  1. Add catchtouchmove='true' to the view
<view catchtouchmove='true' ></view>
  1. Bind an empty method to catchtouchmove.
<view catchtouchmove='prevent' ></view>
prevent(){
    
    
    return ;
}

Friendly reminder: The effect of not scrolling needs to be viewed on the real device, and the effect cannot be seen on the editor

Guess you like

Origin blog.csdn.net/qq_43248623/article/details/108385494