wx.showModal-​显示模态弹窗

OBJECT参数说明:

参数类型必填说明最低版本
titleString提示的内容
iconString图标,有效值"success"、"loading"
imageString自定义图标的本地路径,image 的优先级高于 icon1.1.0
durationNumber提示的延迟时间,单位毫秒,默认:1500
maskBoolean是否显示透明蒙层,防止触摸穿透,默认:false
successFunction接口调用成功的回调函数
failFunction接口调用失败的回调函数
completeFunction接口调用结束的回调函数(调用成功、失败都会执行)


示例代码

wx.showModal({
      title: '提示',
      content: '这是一个模态弹窗',
      success: function (res) {
        if (res.confirm) {
          console.log('用户点击确定')
        } else if (res.cancel) {
          console.log('用户点击取消')
        }
      }
    })