forked from feifadaima/AutoJs-Docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdialogs.json
More file actions
561 lines (561 loc) · 34.1 KB
/
dialogs.json
File metadata and controls
561 lines (561 loc) · 34.1 KB
1
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
{
"source": "..\\api\\dialogs.md",
"modules": [
{
"textRaw": "Dialogs",
"name": "dialogs",
"stability": 2,
"stabilityText": "Stable",
"desc": "<p>dialogs 模块提供了简单的对话框支持,可以通过对话框和用户进行交互。最简单的例子如下:</p>\n<pre><code>alert("您好");\n</code></pre><p>这段代码会弹出一个消息提示框显示"您好",并在用户点击"确定"后继续运行。稍微复杂一点的例子如下:</p>\n<pre><code>var clear = confirm("要清除所有缓存吗?");\nif(clear){\n alert("清除成功!");\n}\n</code></pre><p><code>confirm()</code>会弹出一个对话框并让用户选择"是"或"否",如果选择"是"则返回true。</p>\n<p>需要特别注意的是,对话框在ui模式下不能像通常那样使用,应该使用回调函数或者<a href=\"https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise\">Promise</a>的形式。理解这一点可能稍有困难。举个例子:</p>\n<pre><code>"ui";\n//回调形式\n confirm("要清除所有缓存吗?", function(clear){\n if(clear){\n alert("清除成功!");\n }\n });\n//Promise形式\nconfirm("要清除所有缓存吗?")\n .then(clear => {\n if(clear){\n alert("清除成功!");\n }\n });\n</code></pre>",
"methods": [
{
"textRaw": "dialogs.alert(title[, content, callback])",
"type": "method",
"name": "alert",
"signatures": [
{
"params": [
{
"textRaw": "`title` {string} 对话框的标题。 ",
"name": "title",
"type": "string",
"desc": "对话框的标题。"
},
{
"textRaw": "`content` {string} 可选,对话框的内容。默认为空。 ",
"name": "content",
"type": "string",
"desc": "可选,对话框的内容。默认为空。",
"optional": true
},
{
"textRaw": "`callback` {Function} 回调函数,可选。当用户点击确定时被调用,一般用于ui模式。 ",
"name": "callback",
"type": "Function",
"desc": "回调函数,可选。当用户点击确定时被调用,一般用于ui模式。",
"optional": true
}
]
},
{
"params": [
{
"name": "title"
},
{
"name": "content",
"optional": true
},
{
"name": "callback",
"optional": true
}
]
}
],
"desc": "<p>显示一个只包含“确定”按钮的提示对话框。直至用户点击确定脚本才继续运行。</p>\n<p>该函数也可以作为全局函数使用。</p>\n<pre><code>alert("出现错误~", "出现未知错误,请联系脚本作者”);\n</code></pre><p>在ui模式下该函数返回一个<code>Promise</code>。例如:</p>\n<pre><code>"ui";\nalert("嘿嘿嘿").then(()=>{\n //当点击确定后会执行这里\n});\n</code></pre>"
},
{
"textRaw": "dialogs.confirm(title[, content, callback])",
"type": "method",
"name": "confirm",
"signatures": [
{
"params": [
{
"textRaw": "`title` {string} 对话框的标题。 ",
"name": "title",
"type": "string",
"desc": "对话框的标题。"
},
{
"textRaw": "`content` {string} 可选,对话框的内容。默认为空。 ",
"name": "content",
"type": "string",
"desc": "可选,对话框的内容。默认为空。",
"optional": true
},
{
"textRaw": "`callback` {Function} 回调函数,可选。当用户点击确定时被调用,一般用于ui模式。 ",
"name": "callback",
"type": "Function",
"desc": "回调函数,可选。当用户点击确定时被调用,一般用于ui模式。",
"optional": true
}
]
},
{
"params": [
{
"name": "title"
},
{
"name": "content",
"optional": true
},
{
"name": "callback",
"optional": true
}
]
}
],
"desc": "<p>显示一个包含“确定”和“取消”按钮的提示对话框。如果用户点击“确定”则返回 <code>true</code> ,否则返回 <code>false</code> 。</p>\n<p>该函数也可以作为全局函数使用。</p>\n<p>在ui模式下该函数返回一个<code>Promise</code>。例如:</p>\n<pre><code>"ui";\nconfirm("确定吗").then(value=>{\n //当点击确定后会执行这里, value为true或false, 表示点击"确定"或"取消"\n});\n</code></pre>"
},
{
"textRaw": "dialogs.rawInput(title[, prefill, callback])",
"type": "method",
"name": "rawInput",
"signatures": [
{
"params": [
{
"textRaw": "`title` {string} 对话框的标题。 ",
"name": "title",
"type": "string",
"desc": "对话框的标题。"
},
{
"textRaw": "`prefill` {string} 输入框的初始内容,可选,默认为空。 ",
"name": "prefill",
"type": "string",
"desc": "输入框的初始内容,可选,默认为空。",
"optional": true
},
{
"textRaw": "`callback` {Function} 回调函数,可选。当用户点击确定时被调用,一般用于ui模式。 ",
"name": "callback",
"type": "Function",
"desc": "回调函数,可选。当用户点击确定时被调用,一般用于ui模式。",
"optional": true
}
]
},
{
"params": [
{
"name": "title"
},
{
"name": "prefill",
"optional": true
},
{
"name": "callback",
"optional": true
}
]
}
],
"desc": "<p>显示一个包含输入框的对话框,等待用户输入内容,并在用户点击确定时将输入的字符串返回。如果用户取消了输入,返回null。</p>\n<p>该函数也可以作为全局函数使用。</p>\n<pre><code>var name = rawInput("请输入您的名字", "小明");\nalert("您的名字是" + name);\n</code></pre><p>在ui模式下该函数返回一个<code>Promise</code>。例如:</p>\n<pre><code>"ui";\nrawInput("请输入您的名字", "小明").then(name => {\n alert("您的名字是" + name);\n});\n</code></pre><p>当然也可以使用回调函数,例如:</p>\n<pre><code>rawInput("请输入您的名字", "小明", name => {\n alert("您的名字是" + name);\n});\n</code></pre>"
},
{
"textRaw": "dialogs.input(title[, prefill, callback])",
"type": "method",
"name": "input",
"desc": "<p>等效于 <code>eval(dialogs.rawInput(title, prefill, callback))</code>, 该函数和rawInput的区别在于,会把输入的字符串用eval计算一遍再返回,返回的可能不是字符串。</p>\n<p>可以用该函数输入数字、数组等。例如:</p>\n<pre><code>var age = dialogs.input("请输入您的年龄", "18");\n// new Date().getYear() + 1900 可获取当前年份\nvar year = new Date().getYear() + 1900 - age;\nalert("您的出生年份是" + year);\n</code></pre><p>在ui模式下该函数返回一个<code>Promise</code>。例如:</p>\n<pre><code>"ui";\ndialogs.input("请输入您的年龄", "18").then(age => {\n var year = new Date().getYear() + 1900 - age;\n alert("您的出生年份是" + year);\n});\n</code></pre>",
"signatures": [
{
"params": [
{
"name": "title"
},
{
"name": "prefill",
"optional": true
},
{
"name": "callback",
"optional": true
}
]
}
]
},
{
"textRaw": "dialogs.prompt(title[, prefill, callback])",
"type": "method",
"name": "prompt",
"desc": "<p>相当于 <code>dialogs.rawInput()</code>;</p>\n",
"signatures": [
{
"params": [
{
"name": "title"
},
{
"name": "prefill",
"optional": true
},
{
"name": "callback",
"optional": true
}
]
}
]
},
{
"textRaw": "dialogs.select(title, items, callback)",
"type": "method",
"name": "select",
"signatures": [
{
"params": [
{
"textRaw": "`title` {string} 对话框的标题。 ",
"name": "title",
"type": "string",
"desc": "对话框的标题。"
},
{
"textRaw": "`items` {Array} 对话框的选项列表,是一个字符串数组。 ",
"name": "items",
"type": "Array",
"desc": "对话框的选项列表,是一个字符串数组。"
},
{
"textRaw": "`callback` {Function} 回调函数,可选。当用户点击确定时被调用,一般用于ui模式。 ",
"name": "callback",
"type": "Function",
"desc": "回调函数,可选。当用户点击确定时被调用,一般用于ui模式。"
}
]
},
{
"params": [
{
"name": "title"
},
{
"name": "items"
},
{
"name": "callback"
}
]
}
],
"desc": "<p>显示一个带有选项列表的对话框,等待用户选择,返回用户选择的选项索引(0 ~ item.length - 1)。如果用户取消了选择,返回-1。</p>\n<pre><code>var options = ["选项A", "选项B", "选项C", "选项D"]\nvar i = dialogs.select("请选择一个选项", options);\nif(i >= 0){\n toast("您选择的是" + options[i]);\n}else{\n toast("您取消了选择");\n}\n</code></pre><p>在ui模式下该函数返回一个<code>Promise</code>。例如:</p>\n<pre><code>"ui";\ndialogs.select("请选择一个选项", ["选项A", "选项B", "选项C", "选项D"])\n .then(i => {\n toast(i);\n });\n</code></pre>"
},
{
"textRaw": "dialogs.singleChoice(title, items[, index, callback])",
"type": "method",
"name": "singleChoice",
"signatures": [
{
"params": [
{
"textRaw": "`title` {string} 对话框的标题。 ",
"name": "title",
"type": "string",
"desc": "对话框的标题。"
},
{
"textRaw": "`items` {Array} 对话框的选项列表,是一个字符串数组。 ",
"name": "items",
"type": "Array",
"desc": "对话框的选项列表,是一个字符串数组。"
},
{
"textRaw": "`index` {number} 对话框的初始选项的位置,默认为0。 ",
"name": "index",
"type": "number",
"desc": "对话框的初始选项的位置,默认为0。",
"optional": true
},
{
"textRaw": "`callback` {Function} 回调函数,可选。当用户点击确定时被调用,一般用于ui模式。 ",
"name": "callback",
"type": "Function",
"desc": "回调函数,可选。当用户点击确定时被调用,一般用于ui模式。",
"optional": true
}
]
},
{
"params": [
{
"name": "title"
},
{
"name": "items"
},
{
"name": "index",
"optional": true
},
{
"name": "callback",
"optional": true
}
]
}
],
"desc": "<p>显示一个单选列表对话框,等待用户选择,返回用户选择的选项索引(0 ~ item.length - 1)。如果用户取消了选择,返回-1。</p>\n<p>在ui模式下该函数返回一个<code>Promise</code>。</p>\n"
},
{
"textRaw": "dialogs.multiChoice(title, items[, indices, callback])",
"type": "method",
"name": "multiChoice",
"signatures": [
{
"params": [
{
"textRaw": "`title` {string} 对话框的标题。 ",
"name": "title",
"type": "string",
"desc": "对话框的标题。"
},
{
"textRaw": "`items` {Array} 对话框的选项列表,是一个字符串数组。 ",
"name": "items",
"type": "Array",
"desc": "对话框的选项列表,是一个字符串数组。"
},
{
"textRaw": "`indices` {Array} 选项列表中初始选中的项目索引的数组,默认为空数组。 ",
"name": "indices",
"type": "Array",
"desc": "选项列表中初始选中的项目索引的数组,默认为空数组。",
"optional": true
},
{
"textRaw": "`callback` {Function} 回调函数,可选。当用户点击确定时被调用,一般用于ui模式。 ",
"name": "callback",
"type": "Function",
"desc": "回调函数,可选。当用户点击确定时被调用,一般用于ui模式。",
"optional": true
}
]
},
{
"params": [
{
"name": "title"
},
{
"name": "items"
},
{
"name": "indices",
"optional": true
},
{
"name": "callback",
"optional": true
}
]
}
],
"desc": "<p>显示一个多选列表对话框,等待用户选择,返回用户选择的选项索引的数组。如果用户取消了选择,返回<code>[]</code>。</p>\n<p>在ui模式下该函数返回一个<code>Promise</code>。</p>\n"
},
{
"textRaw": "dialogs.build(properties)",
"type": "method",
"name": "build",
"signatures": [
{
"params": [
{
"textRaw": "`properties` {Object} 对话框属性,用于配置对话框。 ",
"name": "properties",
"type": "Object",
"desc": "对话框属性,用于配置对话框。"
},
{
"textRaw": "返回 {Dialog} ",
"name": "返回",
"type": "Dialog"
}
]
},
{
"params": [
{
"name": "properties"
}
]
}
],
"desc": "<p>创建一个可自定义的对话框,例如:</p>\n<pre><code>dialogs.build({\n //对话框标题\n title: "发现新版本",\n //对话框内容\n content: "更新日志: 新增了若干了BUG",\n //确定键内容\n positive: "下载",\n //取消键内容\n negative: "取消",\n //中性键内容\n neutral: "到浏览器下载",\n //勾选框内容\n checkBoxPrompt: "不再提示"\n}).on("positive", ()=>{\n //监听确定键\n toast("开始下载....");\n}).on("neutral", ()=>{\n //监听中性键\n app.openUrl("https://www.autojs.org");\n}).on("check", (checked)=>{\n //监听勾选框\n log(checked);\n}).show();\n</code></pre><p>选项properties可供配置的项目为:</p>\n<ul>\n<li><code>title</code> {string} 对话框标题</li>\n<li><code>titleColor</code> {string} | {number} 对话框标题的颜色</li>\n<li><code>buttonRippleColor</code> {string} | {number} 对话框按钮的波纹效果颜色</li>\n<li><code>icon</code> {string} | {Image} 对话框的图标,是一个URL或者图片对象 </li>\n<li><code>content</code> {string} 对话框文字内容 </li>\n<li><code>contentColor</code>{string} | {number} 对话框文字内容的颜色</li>\n<li><code>contentLineSpacing</code>{number} 对话框文字内容的行高倍数,1.0为一倍行高</li>\n<li><code>items</code> {Array} 对话框列表的选项</li>\n<li><code>itemsColor</code> {string} | {number} 对话框列表的选项的文字颜色</li>\n<li><code>itemsSelectMode</code> {string} 对话框列表的选项选择模式,可以为:<ul>\n<li><code>select</code> 普通选择模式</li>\n<li><code>single</code> 单选模式</li>\n<li><code>multi</code> 多选模式</li>\n</ul>\n</li>\n<li><code>itemsSelectedIndex</code> {number} | {Array} 对话框列表中预先选中的项目索引,如果是单选模式为一个索引;多选模式则为数组</li>\n<li><code>positive</code> {string} 对话框确定按钮的文字内容(最右边按钮)</li>\n<li><code>positiveColor</code> {string} | {number} 对话框确定按钮的文字颜色(最右边按钮)</li>\n<li><code>neutral</code> {string} 对话框中立按钮的文字内容(最左边按钮)</li>\n<li><code>neutralColor</code> {string} | {number} 对话框中立按钮的文字颜色(最左边按钮)</li>\n<li><code>negative</code> {string} 对话框取消按钮的文字内容(确定按钮左边的按钮)</li>\n<li><code>negativeColor</code> {string} | {number} 对话框取消按钮的文字颜色(确定按钮左边的按钮)</li>\n<li><code>checkBoxPrompt</code> {string} 勾选框文字内容</li>\n<li><code>checkBoxChecked</code> {boolean} 勾选框是否勾选 </li>\n<li><code>progress</code> {Object} 配置对话框进度条的对象:<ul>\n<li><code>max</code> {number} 进度条的最大值,如果为-1则为无限循环的进度条</li>\n<li><code>horizontal</code> {boolean} 如果为true, 则对话框无限循环的进度条为水平进度条</li>\n<li><code>showMinMax</code> {boolean} 是否显示进度条的最大值和最小值</li>\n</ul>\n</li>\n<li><code>cancelable</code> {boolean} 对话框是否可取消,如果为false,则对话框只能用代码手动取消</li>\n<li><code>canceledOnTouchOutside</code> {boolean} 对话框是否在点击对话框以外区域时自动取消,默认为true</li>\n<li><code>inputHint</code> {string} 对话框的输入框的输入提示</li>\n<li><code>inputPrefill</code> {string} 对话框输入框的默认输入内容</li>\n</ul>\n<p>通过这些选项可以自定义一个对话框,并通过监听返回的Dialog对象的按键、输入事件来实现交互。下面是一些例子。</p>\n<p>模拟alert对话框:</p>\n<pre><code>dialogs.build({\n title: "你好",\n content: "今天也要元气满满哦",\n positive: "好的"\n}).show();\n</code></pre><p>模拟confirm对话框:</p>\n<pre><code>dialogs.build({\n title: "你好",\n content: "请问你是笨蛋吗?",\n positive: "是的",\n negative: "我是大笨蛋"\n}).on("positive", ()=>{\n alert("哈哈哈笨蛋");\n}).on("negative", ()=>{\n alert("哈哈哈大笨蛋");\n}).show();\n</code></pre><p>模拟单选框:</p>\n<pre><code>dialogs.build({\n title: "单选",\n items: ["选项1", "选项2", "选项3", "选项4"],\n itemsSelectMode: "single",\n itemsSelectedIndex: 3\n}).on("single_choice", (index, item)=>{\n toast("您选择的是" + item);\n}).show();\n</code></pre><p>"处理中"对话框:</p>\n<pre><code>var d = dialogs.build({\n title: "下载中...",\n progress: {\n max: -1\n },\n cancelable: false\n}).show();\n\nsetTimeout(()=>{\n d.dismiss();\n}, 3000);\n</code></pre><p>输入对话框:</p>\n<pre><code>dialogs.build({\n title: "请输入您的年龄",\n inputPrefill: "18"\n}).on("input", (input)=>{\n var age = parseInt(input);\n toastLog(age);\n}).show();\n</code></pre><p>使用这个函数来构造对话框,一个明显的不同是需要使用回调函数而不能像dialogs其他函数一样同步地返回结果;但也可以通过threads模块的方法来实现。例如显示一个输入框并获取输入结果为:</p>\n<pre><code>var input = threads.disposable();\ndialogas.build({\n title: "请输入您的年龄",\n inputPrefill: "18"\n}).on("input", text => {\n input.setAndNotify(text);\n}).show();\nvar age = parseInt(input.blockedGet());\ntosatLog(age);\n</code></pre>"
}
],
"type": "module",
"displayName": "Dialogs"
},
{
"textRaw": "Dialog",
"name": "dialog",
"desc": "<p><code>dialogs.build()</code>返回的对话框对象,内置一些事件用于响应用户的交互,也可以获取对话框的状态和信息。</p>\n",
"modules": [
{
"textRaw": "事件: `show`",
"name": "事件:_`show`",
"desc": "<ul>\n<li><code>dialog</code> {Dialog} 对话框</li>\n</ul>\n<p>对话框显示时会触发的事件。例如:</p>\n<pre><code>dialogs.build({\n title: "标题"\n}).on("show", (dialog)=>{\n toast("对话框显示了");\n}).show();\n</code></pre>",
"type": "module",
"displayName": "事件: `show`"
},
{
"textRaw": "事件: `cancel`",
"name": "事件:_`cancel`",
"desc": "<ul>\n<li><code>dialog</code> {Dialog} 对话框</li>\n</ul>\n<p>对话框被取消时会触发的事件。一个对话框可能按取消按钮、返回键取消或者点击对话框以外区域取消。例如:</p>\n<pre><code>dialogs.build({\n title: "标题",\n positive: "确定",\n negative: "取消"\n}).on("cancel", (dialog)=>{\n toast("对话框取消了");\n}).show();\n</code></pre>",
"type": "module",
"displayName": "事件: `cancel`"
},
{
"textRaw": "事件: `dismiss`",
"name": "事件:_`dismiss`",
"desc": "<ul>\n<li><code>dialog</code> {Dialog} 对话框</li>\n</ul>\n<p>对话框消失时会触发的事件。对话框被取消或者手动调用<code>dialog.dismiss()</code>函数都会触发该事件。例如:</p>\n<pre><code>var d = dialogs.build({\n title: "标题",\n positive: "确定",\n negative: "取消"\n}).on("dismiss", (dialog)=>{\n toast("对话框消失了");\n}).show();\n\nsetTimeout(()=>{\n d.dismiss();\n}, 5000);\n</code></pre>",
"type": "module",
"displayName": "事件: `dismiss`"
},
{
"textRaw": "事件: `positive`",
"name": "事件:_`positive`",
"desc": "<ul>\n<li><code>dialog</code> {Dialog} 对话框</li>\n</ul>\n<p>确定按钮按下时触发的事件。例如:</p>\n<pre><code>var d = dialogs.build({\n title: "标题",\n positive: "确定",\n negative: "取消"\n}).on("positive", (dialog)=>{\n toast("你点击了确定");\n}).show();\n</code></pre>",
"type": "module",
"displayName": "事件: `positive`"
},
{
"textRaw": "事件: `negative`",
"name": "事件:_`negative`",
"desc": "<ul>\n<li><code>dialog</code> {Dialog} 对话框</li>\n</ul>\n<p>取消按钮按下时触发的事件。例如:</p>\n<pre><code>var d = dialogs.build({\n title: "标题",\n positive: "确定",\n negative: "取消"\n}).on("negative", (dialog)=>{\n toast("你点击了取消");\n}).show();\n</code></pre>",
"type": "module",
"displayName": "事件: `negative`"
},
{
"textRaw": "事件: `neutral`",
"name": "事件:_`neutral`",
"desc": "<ul>\n<li><code>dialog</code> {Dialog} 对话框</li>\n</ul>\n<p>中性按钮按下时触发的事件。例如:</p>\n<pre><code>var d = dialogs.build({\n title: "标题",\n positive: "确定",\n negative: "取消",\n neutral: "稍后提示"\n}).on("positive", (dialog)=>{\n toast("你点击了稍后提示");\n}).show();\n</code></pre>",
"type": "module",
"displayName": "事件: `neutral`"
},
{
"textRaw": "事件: `any`",
"name": "事件:_`any`",
"desc": "<ul>\n<li><code>dialog</code> {Dialog} 对话框</li>\n<li><code>action</code> {string} 被点击的按钮,可能的值为:<ul>\n<li><code>positive</code> 确定按钮 </li>\n<li><code>negative</code> 取消按钮</li>\n<li><code>neutral</code> 中性按钮</li>\n</ul>\n</li>\n</ul>\n<p>任意按钮按下时触发的事件。例如:</p>\n<pre><code>var d = dialogs.build({\n title: "标题",\n positive: "确定",\n negative: "取消",\n neutral: "稍后提示"\n}).on("any", (action, dialog)=>{\n if(action == "positive"){\n toast("你点击了确定");\n }else if(action == "negative"){\n toast("你点击了取消");\n }\n}).show();\n</code></pre>",
"type": "module",
"displayName": "事件: `any`"
},
{
"textRaw": "事件: `item_select`",
"name": "事件:_`item_select`",
"desc": "<ul>\n<li><code>index</code> {number} 被选中的项目索引,从0开始</li>\n<li><code>item</code> {Object} 被选中的项目</li>\n<li><code>dialog</code> {Dialog} 对话框</li>\n</ul>\n<p>对话框列表(itemsSelectMode为"select")的项目被点击选中时触发的事件。例如:</p>\n<pre><code>var d = dialogs.build({\n title: "请选择",\n positive: "确定",\n negative: "取消",\n items: ["A", "B", "C", "D"],\n itemsSelectMode: "select"\n}).on("item_select", (index, item, dialog)=>{\n toast("您选择的是第" + (index + 1) + "项, 选项为" + item);\n}).show();\n</code></pre>",
"type": "module",
"displayName": "事件: `item_select`"
},
{
"textRaw": "事件: `single_choice`",
"name": "事件:_`single_choice`",
"desc": "<ul>\n<li><code>index</code> {number} 被选中的项目索引,从0开始</li>\n<li><code>item</code> {Object} 被选中的项目</li>\n<li><code>dialog</code> {Dialog} 对话框</li>\n</ul>\n<p>对话框单选列表(itemsSelectMode为"singleChoice")的项目被选中并点击确定时触发的事件。例如:</p>\n<pre><code>var d = dialogs.build({\n title: "请选择",\n positive: "确定",\n negative: "取消",\n items: ["A", "B", "C", "D"],\n itemsSelectMode: "singleChoice"\n}).on("item_select", (index, item, dialog)=>{\n toast("您选择的是第" + (index + 1) + "项, 选项为" + item);\n}).show();\n</code></pre>",
"type": "module",
"displayName": "事件: `single_choice`"
},
{
"textRaw": "事件: `multi_choice`",
"name": "事件:_`multi_choice`",
"desc": "<ul>\n<li><code>indices</code> {Array} 被选中的项目的索引的数组</li>\n<li><code>items</code> {Array} 被选中的项目的数组</li>\n<li><code>dialog</code> {Dialog} 对话框</li>\n</ul>\n<p>对话框多选列表(itemsSelectMode为"multiChoice")的项目被选中并点击确定时触发的事件。例如:</p>\n<pre><code>var d = dialogs.build({\n title: "请选择",\n positive: "确定",\n negative: "取消",\n items: ["A", "B", "C", "D"],\n itemsSelectMode: "multiChoice"\n}).on("item_select", (indices, items, dialog)=>{\n toast(util.format("您选择的项目为%o, 选项为%o", indices, items);\n}).show();\n</code></pre>",
"type": "module",
"displayName": "事件: `multi_choice`"
},
{
"textRaw": "事件: `input`",
"name": "事件:_`input`",
"desc": "<ul>\n<li><code>text</code> {string} 输入框的内容</li>\n<li><code>dialog</code> {Dialog} 对话框</li>\n</ul>\n<p>带有输入框的对话框当点击确定时会触发的事件。例如:</p>\n<pre><code>dialogs.build({\n title: "请输入",\n positive: "确定",\n negative: "取消",\n inputPrefill: ""\n}).on("input", (text, dialog)=>{\n toast("你输入的是" + text);\n}).show();\n</code></pre>",
"type": "module",
"displayName": "事件: `input`"
},
{
"textRaw": "事件: `input_change`",
"name": "事件:_`input_change`",
"desc": "<ul>\n<li><code>text</code> {string} 输入框的内容</li>\n<li><code>dialog</code> {Dialog} 对话框</li>\n</ul>\n<p>对话框的输入框的文本发生变化时会触发的事件。例如:</p>\n<pre><code>dialogs.build({\n title: "请输入",\n positive: "确定",\n negative: "取消",\n inputPrefill: ""\n}).on("input_change", (text, dialog)=>{\n toast("你输入的是" + text);\n}).show();\n</code></pre>",
"type": "module",
"displayName": "事件: `input_change`"
}
],
"methods": [
{
"textRaw": "dialog.getProgress()",
"type": "method",
"name": "getProgress",
"signatures": [
{
"params": [
{
"textRaw": "返回 {number} ",
"name": "返回",
"type": "number"
}
]
},
{
"params": []
}
],
"desc": "<p>获取当前进度条的进度值,是一个整数</p>\n"
},
{
"textRaw": "dialog.getMaxProgress()",
"type": "method",
"name": "getMaxProgress",
"signatures": [
{
"params": [
{
"textRaw": "返回 {number} ",
"name": "返回",
"type": "number"
}
]
},
{
"params": []
}
],
"desc": "<p>获取当前进度条的最大进度值,是一个整数</p>\n"
},
{
"textRaw": "dialog.getActionButton(action)",
"type": "method",
"name": "getActionButton",
"signatures": [
{
"params": [
{
"textRaw": "`action` {string} 动作,包括: ",
"options": [
{
"textRaw": "`positive` ",
"name": "positive"
},
{
"textRaw": "`negative` ",
"name": "negative"
},
{
"textRaw": "`neutral` ",
"name": "neutral"
}
],
"name": "action",
"type": "string",
"desc": "动作,包括:"
}
]
},
{
"params": [
{
"name": "action"
}
]
}
]
}
],
"type": "module",
"displayName": "Dialog"
}
]
}