● 显示模态对话框showModal
分类:交互
是否支持H5:支持
参数
Object object
| 参数名 | 类型 | 默认值 | 必填 | 说明 |
|---|---|---|---|---|
| title | string | 否 | 弹窗标题 | |
| content | string | 否 | 弹窗提示内容 | |
| showCancel | boolean | 否 | 是否显示取消按钮 | |
| confirmText | string | 否 | 确认按钮文本 | |
| cancelText | string | 否 | 取消按钮文本 | |
| cancelColor | string | #000000 | 否 | 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 |
| confirmColor | string | #576B95 | 否 | 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | |
| complete | function | 否 | 接口调用结束的回调函数(接口调用成功、失败都会执行) |
调用示例
原生
wx.showModal({
title: '弹窗标题',
content: '弹窗内容,告知当前状态、信息和解决方法,描述文字尽量控制在三行内',
showCancel: true,
confirmText: '确定',
cancelText: '取消'
success: function (res) {
console.log(res)
}
})
H5
const _data = {
title: '弹窗标题',
content: '弹窗内容,告知当前状态、信息和解决方法,描述文字尽量控制在三行内',
showCancel: true,
confirmText: '确定',
cancelText: '取消'
}
PAMINA.call('showModal', _data, res => {
console.log(res)
}, e => {
console.log(e)
})