小程序使用弹窗组件Modal,阻止冒泡事件

 在modal组件上加一个catchtap事件(里面不写内容都可以),亲测有效!


    是否拨打电话xxxxxxxxxxx?
/* 打电话 */
    handleOpen() {
      this.setData({
        visible: true
      });
    },
    handleClose() {
      this.setData({
        visible: false
      });
      return false;
    },
    call(){
      const phoneNumber = 'xxxxxxxxxxx';
      wx.makePhoneCall({
        phoneNumber,
        success: function(res) {},
        fail: function(res) {},
        complete: function(res) {},
      })
      this.setData({
        visible: false
      });
      return false;
    },
    /* 阻止冒泡事件 */
    stopPropagation(){
      return;
    }

 

你可能感兴趣的:(微信小程序)