# showModal
显示模态弹窗。
# 支持说明
应用能力 | Android | iOS | PC | 预览效果 |
---|---|---|---|---|
小程序 | 3.1.0 | 3.1.0 | 3.2.0 | 扫码预览 用BoosHi扫码或PC端点击 |
网页应用 | 3.3.0 | 3.3.0 | 待开发 | 待补充 |
# 输入
继承标准对象输入,扩展属性描述:
名称 | 数据类型 | 必填 | 默认值 | 描述 |
---|---|---|---|---|
title | string | 否 | 标题 | |
content | string | 否 | 内容 | |
confirmText | string | 否 | OK | 确定按钮的文案 |
cancelText | string | 否 | Cancel | 取消按钮的文案 |
showCancel | boolean | 否 | true | 是否显示取消按钮 |
TIP
title
和content
不可同时为空。
# 输出
继承标准对象输出
success
返回对象的扩展属性:
名称 | 数据类型 | 描述 |
---|---|---|
confirm | boolean | 是否点击了确定按钮 |
cancel | boolean | 是否点击了取消按钮 |
# 示例代码
bz.showModal({
"title": "请求获得定位权限",
"content": "获得你的地理位置能够更好的为你推荐本地信息",
"confirmText": "授予权限",
"cancelText": "取消",
"showCancel": true,
success(res) {
console.log(JSON.stringify(res));
},
fail(res) {
console.log(`showModal fail: ${JSON.stringify(res)}`);
}
});
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
success
返回对象示例:
{
"errMsg": "showModal:ok",
"confirm": true,
"cancel": false
}
1
2
3
4
5
2
3
4
5