Home > SYS_Dialog > showInputDialog
SYS_Dialog.showInputDialog() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
弹出输入窗口
签名
typescript
showInputDialog(beforeContent?: string, afterContent?: string, title?: string, type?: 'color' | 'date' | 'datetime-local' | 'email' | 'mouth' | 'number' | 'password' | 'tel' | 'text' | 'time' | 'url' | 'week', value?: string | number, otherProperty?: {
max?: number;
maxlength?: number;
min?: number;
minlength?: number;
multiple?: boolean;
pattern?: RegExp;
placeholder?: string;
readonly?: boolean;
step?: number;
}, callbackFn?: (value: any) => void): void;
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
参数名
参数 | 类型 | 描述 |
---|---|---|
beforeContent | string | (Optional) 输入框上方文字 |
afterContent | string | (Optional) 输入框下方文字 |
title | string | (Optional) 弹出窗口标题 |
type | 'color' | 'date' | 'datetime-local' | 'email' | 'mouth' | 'number' | 'password' | 'tel' | 'text' | 'time' | 'url' | 'week' | (Optional) 输入框类型 |
value | string | number | (Optional) 输入框默认值 |
otherProperty | { max?: number; maxlength?: number; min?: number; minlength?: number; multiple?: boolean; pattern?: RegExp; placeholder?: string; readonly?: boolean; step?: number; } | (Optional) 其它参数,可参考 The HTML Input element |
callbackFn | (value: any) => void | (Optional) 回调函数 |
返回值
void
用户输入的值,始终为 string
类型,除非用户点击了 **取消** 按钮