以Promise风格调用: 支持
显示消息提示框
属性 | 类型 | 默认值 | 必填 | 说明 |
|---|---|---|---|---|
| title | string | 否 | 提示的标题 | |
| content | string | 否 | 提示的内容 | |
| showCancel | boolean | true | 否 | 是否显示取消按钮 |
| cancelText | string | 取消 | 否 | 取消按钮的文字,最多 4 个字符 |
| cancelColor | string | #333333 | 否 | 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 |
| confirmText | string | 确定 | 否 | 确认按钮的文字,最多 4 个字符 |
| confirmColor | string | #FF2442 | 否 | 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 |
| editable | boolean | false | 否 | 是否显示输入框 |
| placeholderText | string | 否 | 显示输入框时的提示文本 | |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
属性 | 类型 | 说明 |
|---|---|---|
| errMsg | string | |
| cancel | boolean | 是否取消 |
| confirm | boolean | 是否确认 |
xhs.showModal({
title: '提示',
content: '这是一个模态弹窗',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})