|
1 | | -# 窗口右下角通知框 |
| 1 | +# Message |
| 2 | + |
| 3 | +> Notification box in the lower right corner of the window. |
2 | 4 |
|
3 | 5 | ## showErrorMessage |
4 | | -在窗口右下角显示错误通知框 |
5 | | -#### 参数说明 |
6 | 6 |
|
7 | | -|参数名称 |参数类型 |描述 | |
| 7 | +> Show an error message. |
| 8 | +
|
| 9 | +#### Parameter |
| 10 | + |
| 11 | +|Name |Type |Description | |
8 | 12 | |-- |-- |-- | |
9 | | -|message |String |消息内容,支持html标签 | |
10 | | -|buttons |Array<String>|通知框中的按钮组 | |
| 13 | +|message |String |Message content, support html tags | |
| 14 | +|buttons |Array<String>|Button group in notification box | |
| 15 | + |
| 16 | +#### Returns |
11 | 17 |
|
12 | | -#### 返回值 |
13 | | -|返回类型 |描述 | |
| 18 | +|Type |Description | |
14 | 19 | |-- |-- | |
15 | | -|Promise<String> |如果设置了按钮,返回用户点击了哪个按钮 | |
| 20 | +|Promise<String> |If a button is set, return which button the user clicked | |
16 | 21 |
|
17 | | -#### 示例 |
| 22 | +#### Example |
18 | 23 | ``` javascript |
19 | | - let resultPromise = hx.window.showErrorMessage('是否删除该文件?',['是','否']); |
20 | | - resultPromise.then((result)=>{ |
21 | | - if(result == '是'){ |
22 | | - console.log("选择了是"); |
23 | | - }else if(result === '否'){ |
24 | | - console.log("选择了否"); |
25 | | - } |
26 | | - }); |
| 24 | +let resultPromise = hx.window.showErrorMessage('Do you want to delete the file?',['Yes','No']); |
| 25 | +resultPromise.then((result)=>{ |
| 26 | + if(result == 'Yes'){ |
| 27 | + console.log("Your choice: Yes"); |
| 28 | + }else if(result === 'No'){ |
| 29 | + console.log("Your choice: No"); |
| 30 | + } |
| 31 | +}); |
27 | 32 | ``` |
28 | 33 |
|
29 | 34 | ## showInformationMessage |
30 | | -在窗口右下角显示消息通知框 |
31 | | -#### 参数说明 |
32 | 35 |
|
33 | | -|参数名称 |参数类型 |描述 | |
| 36 | +> Show an information message to users. |
| 37 | +
|
| 38 | +#### Parameter |
| 39 | + |
| 40 | +|Name |Type |Description | |
34 | 41 | |-- |-- |-- | |
35 | | -|message |String |消息内容,支持html标签 | |
36 | | -|buttons |Array<String>|通知框中的按钮组 | |
| 42 | +|message |String |Message content, support html tags | |
| 43 | +|buttons |Array<String>|Button group in notification box | |
37 | 44 |
|
38 | | -#### 返回值 |
39 | | -|返回类型 |描述 | |
| 45 | +#### Returns |
| 46 | +|Type |Description | |
40 | 47 | |-- |-- | |
41 | | -|Promise<String> |如果设置了按钮,返回用户点击了哪个按钮 | |
| 48 | +|Promise<String> |If a button is set, return which button the user clicked | |
42 | 49 |
|
43 | | -#### 示例 |
| 50 | +#### Example |
44 | 51 | ``` javascript |
45 | | - hx.window.showInformationMessage('详情可访问<a href="http://www.dcloud.io">参考文档</a>'); |
| 52 | +hx.window.showInformationMessage('详情可访问<a href="http://www.dcloud.io">参考文档</a>'); |
46 | 53 | ``` |
47 | | -效果如下: |
48 | 54 |
|
49 | 55 | <img src="/static/snapshots/info.jpg" style="zoom:50%" /> |
50 | 56 |
|
51 | 57 | ## showWarningMessage |
52 | | -在窗口右下角显示警告消息通知框 |
53 | | -#### 参数说明 |
54 | 58 |
|
55 | | -|参数名称 |参数类型 |描述 | |
| 59 | +> Show a warning message. |
| 60 | +
|
| 61 | +#### Parameter |
| 62 | + |
| 63 | +|Name |Type |Description | |
56 | 64 | |-- |-- |-- | |
57 | | -|message |String |消息内容,支持html标签 | |
58 | | -|buttons |Array<String>|通知框中的按钮组 | |
| 65 | +|message |String |Message content, support html tags | |
| 66 | +|buttons |Array<String>|Button group in notification box | |
59 | 67 |
|
60 | | -#### 返回值 |
61 | | -|返回类型 |描述 | |
| 68 | +#### Returns |
| 69 | +|Type |Description | |
62 | 70 | |-- |-- | |
63 | | -|Promise<String> |如果设置了按钮,返回用户点击了哪个按钮 | |
| 71 | +|Promise<String> |If a button is set, return which button the user clicked | |
64 | 72 |
|
65 | | -#### 示例 |
| 73 | +#### Example |
66 | 74 | ``` javascript |
67 | | - let resultPromise = hx.window.showWarningMessage('是否删除该文件?',['是','否']); |
68 | | - resultPromise.then((result)=>{ |
69 | | - if(result == '是'){ |
70 | | - console.log("选择了是"); |
71 | | - }else if(result === '否'){ |
72 | | - console.log("选择了否"); |
73 | | - } |
74 | | - }); |
| 75 | +let resultPromise = hx.window.showWarningMessage('Do you want to delete the file?',['Yes','No']); |
| 76 | +resultPromise.then((result)=>{ |
| 77 | + if(result == 'Yes'){ |
| 78 | + console.log("Your choice: Yes"); |
| 79 | + }else if(result === 'No'){ |
| 80 | + console.log("Your choice: No"); |
| 81 | + } |
| 82 | +}); |
75 | 83 | ``` |
0 commit comments