Wechat applet mp-half-screen-dialog page scrolling problem solved

Wechat applet mp-half-screen-dialog page scrolling problem solved

The WeChat applet uses mp-half-screen-dialog . When sliding mp-half-screen-dialog , if the page is scrolling, it will slide accordingly. In order to avoid this problem, you can use the following solution ( Directly on the code):
wxml:

<mp-half-screen-dialog
  show="{
     
     { show }}"
  maskClosable="{
     
     { maskclosable }}"
  title="{
     
     { detail.workorder_title }}"
  subTitle="{
     
     { detail.workorder_no }}"
  closabled="{
     
     { true }}"
  class="f-half-dialog"
  catchtouchmove="preventTouchMove"
  bindclose="handleHalfDialogClose"
>
</mp-half-screen-dialog>

js:

methods: {
    
    
    handleHalfDialogClose() {
    
    
      // 关闭事件无需刷新列表
      // this.triggerEvent('initShow', {}, { bubbles: true, composed: true })
    },

    preventTouchMove() {
    
    
      // 解决蒙层下页面滚动问题
    }
  }

The essence is that the catchtouchmove="preventTouchMove" in wxml and the preventTouchMove() empty method in js can avoid this problem.

Guess you like

Origin blog.csdn.net/weixin_42371354/article/details/122359246