OBJECT参数说明:
参数 | 类型 | 必填 | 说明 | 最低版本 |
---|---|---|---|---|
title | String | 是 | 提示的内容 | |
icon | String | 否 | 图标,有效值"success"、"loading" | |
image | String | 否 | 自定义图标的本地路径,image 的优先级高于 icon | 1.1.0 |
duration | Number | 否 | 提示的延迟时间,单位毫秒,默认:1500 | |
mask | Boolean | 否 | 是否显示透明蒙层,防止触摸穿透,默认:false | |
success | Function | 否 | 接口调用成功的回调函数 | |
fail | Function | 否 | 接口调用失败的回调函数 | |
complete | Function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
示例代码
wx.showModal({ title: '提示', content: '这是一个模态弹窗', success: function (res) { if (res.confirm) { console.log('用户点击确定') } else if (res.cancel) { console.log('用户点击取消') } } })