Home > SYS_Dialog > showInputDialog
SYS_Dialog.showInputDialog() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Show an input dialog
Signature
function 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?: undefined | number;
maxlength?: undefined | number;
min?: undefined | number;
minlength?: undefined | number;
multiple?: undefined | false | true;
pattern?: undefined | RegExp;
placeholder?: undefined | string;
readonly?: undefined | false | true;
step?: undefined | number;
},
callbackFn?: (value: any) => void,
): void;2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Parameters
Parameter | Type | Description |
|---|---|---|
beforeContent | string | (Optional) Text above the input box |
afterContent | string | (Optional) Text below the input box |
title | string | (Optional) Popup window title |
type | 'color' | 'date' | 'datetime-local' | 'email' | 'mouth' | 'number' | 'password' | 'tel' | 'text' | 'time' | 'url' | 'week' | (Optional) Input box type |
value | string | number | (Optional) Default value of the input box |
otherProperty | { max?: undefined | number; maxlength?: undefined | number; min?: undefined | number; minlength?: undefined | number; multiple?: undefined | false | true; pattern?: undefined | RegExp; placeholder?: undefined | string; readonly?: undefined | false | true; step?: undefined | number } | (Optional) Other parameters. Refer to The HTML Input element |
callbackFn | (value: any) => void | (Optional) Callback function |
Returns
void
The value entered by the user, always of type string, unless the user clicks the **Cancel** button
Example
// 1. 弹出数字输入窗口(默认值 5,范围 1~100)
eda.sys_Dialog.showInputDialog(
'请输入铺铜间距', // 输入框上方文字
'输入 1~100 之间的整数(单位 mil)', // 输入框下方文字
'铺铜设置', // 窗口标题
'number', // 输入类型(同 HTML input 的 type)
5, // 默认值
{ min: 1, max: 100, step: 1 }, // 其它输入属性(min、max、step 等)
(value) => {
console.log('用户输入的间距:', value);
}
);
// 2. 窗口已弹出;回调需用户点击确认后才会触发
console.log('已弹出输入窗口');2
3
4
5
6
7
8
9
10
11
12
13
14
15