# showPrompt

展示可输入内容的弹窗。

# 支持说明

应用能力 Android iOS PC 预览效果
小程序 3.2.0 3.2.0 3.2.0
扫码预览
用BoosHi扫码或PC端点击
网页应用 3.3.0 3.3.0 待开发 待补充

# 输入

继承标准对象输入,扩展属性描述:

名称 数据类型 必填 默认值 描述
title string 标题
placeholder string Please enter your content here 输入框内容为空时的提示文案
maxLength number 140 最大输入长度,设置为-1的时候不限制最大长度
confirmText string OK 确定按钮的文案
cancelText string Cancel 取消按钮的文案

# 输出

继承标准对象输出

success返回对象的扩展属性:

名称 数据类型 描述
confirm boolean 是否点击了确定按钮
cancel boolean 是否点击了取消按钮
inputValue string confirm为true时,用户输入的内容

# 示例代码

bz.showPrompt({
    "title": "这是个输入弹窗",
    "placeholder": "在这里输入内容",
    "maxLength": 50,
    "confirmText": "确定",
    "cancelText": "取消",
    success(res) {
      console.log(JSON.stringify(res));
    },
    fail(res) {
      console.log(`showPrompt fail: ${JSON.stringify(res)}`);
    }
});
1
2
3
4
5
6
7
8
9
10
11
12
13

success返回对象示例:

{
    "errMsg": "showPrompt:ok",
    "confirm": true,
    "cancel": false,
    "inputValue": "示例内容"
}
1
2
3
4
5
6
最后更新于 : 12/15/2022, 2:18:25 PM