|
1 |
| -# Alert 确认对话框 |
| 1 | +# Alert Confirmation dialog box |
2 | 2 |
|
3 | 3 | [](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-alert/file/README.md)
|
4 | 4 | [](https://www.npmjs.com/package/@uiw/react-alert)
|
5 | 5 | [](https://npmjs.com/@uiw/react-alert)
|
6 | 6 |
|
7 |
| -弹出对话框会在继续之前,通知用户重要信息,点击确定后异步关闭对话框。 |
| 7 | +The pop-up dialog box will notify the user of important information before continuing, and click OK to close the dialog box asynchronously. |
8 | 8 |
|
9 | 9 | ```js
|
10 | 10 | import { Alert } from "uiw";
|
11 | 11 | // or
|
12 | 12 | import Alert from "@uiw/react-alert";
|
13 | 13 | ```
|
14 | 14 |
|
15 |
| -## 基本用法 |
| 15 | +## Basic Usage |
16 | 16 |
|
17 | 17 | ```jsx mdx:preview
|
18 | 18 | import React from "react";
|
@@ -70,9 +70,9 @@ class Demo extends React.Component {
|
70 | 70 | export default Demo;
|
71 | 71 | ```
|
72 | 72 |
|
73 |
| -## 延迟关闭对话框 |
| 73 | +## Delay closing dialog |
74 | 74 |
|
75 |
| -这里是利用 `Promise` 等它执行完成再去关闭窗口 |
| 75 | +Here is to use `Promise` to close the window after its execution is completed |
76 | 76 |
|
77 | 77 | ```jsx mdx:preview
|
78 | 78 | import React from "react";
|
@@ -134,9 +134,9 @@ class Demo extends React.Component {
|
134 | 134 | export default Demo;
|
135 | 135 | ```
|
136 | 136 |
|
137 |
| -## 带图标的弹出框 |
| 137 | +## Pop up box with Icon |
138 | 138 |
|
139 |
| -通过设置 `icon` 和 `type` 参数设置带状态的弹出对话框。 |
| 139 | +Set the pop-up dialog box with status by setting the `icon` and `type` parameters. |
140 | 140 |
|
141 | 141 | ```jsx mdx:preview
|
142 | 142 | import React from "react";
|
@@ -242,13 +242,7 @@ class Demo extends React.Component {
|
242 | 242 | export default Demo;
|
243 | 243 | ```
|
244 | 244 |
|
245 |
| -```js |
246 |
| -import { Alert } from "uiw"; |
247 |
| -// or |
248 |
| -import Alert from "@uiw/react-alert"; |
249 |
| -``` |
250 |
| - |
251 |
| -## 带标题的弹出框 |
| 245 | +## Pop up box with title |
252 | 246 |
|
253 | 247 | ```jsx mdx:preview
|
254 | 248 | import React from "react";
|
@@ -359,9 +353,9 @@ class Demo extends React.Component {
|
359 | 353 | export default Demo;
|
360 | 354 | ```
|
361 | 355 |
|
362 |
| -### 自定义按钮 |
| 356 | +### Custom button |
363 | 357 |
|
364 |
| -这个对话框有两个按钮,单击 **`确定按钮`** 或 **`取消按钮`** 后,此对话框将关闭,将不触发 ~~`onConfirm`~~ 或 ~~`onCancel`~~ 事件。因为这俩按钮是自定义按钮。你可以正对自定义按钮外面的对象定义 `className="w-alert-footer"` 将显示默认样式。 |
| 358 | +There are two buttons in this dialog box. After clicking **OK button** or **cancel button**, this dialog box will close and the ~~`onconfirm`~~ or ~~`OnCancel`~~ event will not be triggered. Because these two buttons are custom buttons. You can define `classname = "w-alert-footer"` for the object outside the custom button, and the default style will be displayed. |
365 | 359 |
|
366 | 360 | ```jsx mdx:preview:base23
|
367 | 361 | import React from "react";
|
@@ -415,7 +409,7 @@ class Demo extends React.Component {
|
415 | 409 | export default Demo;
|
416 | 410 | ```
|
417 | 411 |
|
418 |
| -### 不显示遮罩层 |
| 412 | +### Mask layers are not displayed |
419 | 413 |
|
420 | 414 | ```jsx mdx:preview
|
421 | 415 | import React from "react";
|
@@ -463,19 +457,18 @@ export default Demo;
|
463 | 457 |
|
464 | 458 | ## Props
|
465 | 459 |
|
466 |
| -虽然类似于对 `<Modal>`,但 `<Alert>` 更具限制性,只应用于重要信息。此组件继承 [`<Modal>`](#/components/modal) 的属性,所以部分参数可以参考 `<Modal>` 组件。 |
467 |
| - |
468 |
| -| 参数 | 说明 | 类型 | 默认值 | |
469 |
| -| ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ------- | |
470 |
| -| onCancel | 取消按钮的回调函数 | Function(e) | - | |
471 |
| -| onConfirm | 点击确定按钮回调 | Function(e) | - | |
472 |
| -| cancelText | 取消按钮文字, | String | - | |
473 |
| -| confirmText | 确认按钮文字 | String | `确认` | |
474 |
| -| type | 按钮类型跟 `<Button>` 组件的 `type` 参数一致,同时会影响按钮颜色。 | String | `light` | |
475 |
| -| icon[`<Modal>`](#/components/modal) | 设置对话框右上角图标,,设置 `type` 将图标设置不同的颜色。当前属性为 [`<Icon>`](#/components/icon) 组件的 `type` 属性,所以可以参考该组件自定义图标。 | String/ReactNode | - | |
476 |
| -| title[`<Modal>`](#/components/modal) | 设置标题 | Function(e) | - | |
477 |
| -| useButton[`<Modal>`](#/components/modal) | 是否使用默认按钮,如果设置 `false` 需要自定义按钮关闭 | Boolean | `true` | |
478 |
| -| isOpen[`<Modal>`](#/components/modal) | 对话框是否可见 | Boolean | `false` | |
479 |
| -| maskClosable[`<Modal>`](#/components/modal) | 点击遮罩层是否允许关闭 | boolean | `true` | |
| 460 | +Although similar to `<Modal>`, `<Alert>` is more restrictive and applies only to important information. This component inherits the properties of [`<Modal>`](#/components/modal), so some parameters can refer to the `<Modal>` component. |
| 461 | +| parameter | explain | type | Default value | |
| 462 | +| ------------------------------------------- | ----- | ---------------- | ------- | |
| 463 | +| onCancel | Callback function of cancel button | Function(e) | - | |
| 464 | +| onConfirm | Click OK to call back | Function(e) | - | |
| 465 | +| cancelText | Cancel button text, | String | - | |
| 466 | +| confirmText | Confirm button text | String | `确认` | |
| 467 | +| type | The button type is consistent with the `type` parameter of the `<Button>` component and will affect the button color.| String | `light` | |
| 468 | +| icon[`<Modal>`](#/components/modal) | Set the icon in the upper right corner of the dialog box. Set `type` to set the icon to a different color. The current attribute is the `type` attribute of [`<Icon>`](#/components/icon) component, so you can refer to the custom icon of the component. | String/ReactNode | - | |
| 469 | +| title[`<Modal>`](#/components/modal) | Set title | Function(e) | - | |
| 470 | +| useButton[`<Modal>`](#/components/modal) | Whether to use the default button. If you set `false`, you need to customize the button to close | Boolean | `true` | |
| 471 | +| isOpen[`<Modal>`](#/components/modal) | Whether the dialog box is visible | Boolean | `false` | |
| 472 | +| maskClosable[`<Modal>`](#/components/modal) | Click whether the mask layer is allowed to be turned off | boolean | `true` | |
480 | 473 |
|
481 |
| -更多属性文档请参考 [Modal](#/components/modal)。 |
| 474 | +For more attribute documents, please refer to [Modal](#/components/modal)。 |
0 commit comments