2019-09-28 18:50:56 +08:00
|
|
|
# Confirm
|
2020-01-30 18:48:38 +08:00
|
|
|
Before taking action, please confirm.
|
|
|
|
|
|
|
|
## Demos
|
2019-09-28 18:50:56 +08:00
|
|
|
```demo
|
|
|
|
basic
|
|
|
|
async
|
2019-12-06 17:44:58 +08:00
|
|
|
use-component
|
2020-01-30 18:48:38 +08:00
|
|
|
```
|
|
|
|
## API
|
2020-01-30 20:41:49 +08:00
|
|
|
### $NConfirm API
|
2020-02-04 13:23:36 +08:00
|
|
|
|Name|Type|Description|
|
2020-01-30 20:41:49 +08:00
|
|
|
|-|-|-|
|
2020-02-05 12:21:18 +08:00
|
|
|
|warning|`(options: ConfirmOption) => ConfirmEnvironment`||
|
|
|
|
|success|`(options: ConfirmOption) => ConfirmEnvironment`||
|
|
|
|
|error|`(options: ConfirmOption) => ConfirmEnvironment`||
|
|
|
|
|destroyAll|`() => void`||
|
2020-01-30 20:41:49 +08:00
|
|
|
|
|
|
|
### ConfirmOption API
|
|
|
|
|Name|Type|Default|Description|
|
|
|
|
|-|-|-|-|
|
|
|
|
|type|`'error \| 'success' \| 'warning'`|`'warning'`||
|
2020-02-05 23:49:59 +08:00
|
|
|
|title|`string \| function`|`null`|Can be a render function.|
|
2020-01-30 20:41:49 +08:00
|
|
|
|closable|`boolean`|`boolean`||
|
2020-02-05 23:49:59 +08:00
|
|
|
|icon|`function`|`null`|Should be a render function.|
|
|
|
|
|negative-text|`string`|`'Cancel'`||
|
|
|
|
|positive-text|`string`|`'Confirm'`||
|
|
|
|
|content|`string \| function`|`null`|Can be a render function.|
|
2020-01-30 20:41:49 +08:00
|
|
|
|show-icon|`boolean`|`true`||
|
|
|
|
|loading|`boolean`|`false`||
|
|
|
|
|bordered|`boolean`|`false`||
|
2020-02-05 12:21:18 +08:00
|
|
|
|onPositiveClick|`(hide: function) => any`|`hide => hide()`||
|
|
|
|
|onNegativeClick|`(hide: function) => any`|`hide => hide()`|
|
|
|
|
|onClose|`(hide: function) => any`|`hide => hide()`||
|
2020-01-30 20:41:49 +08:00
|
|
|
|
|
|
|
### ConfirmEnvironment API
|
2020-01-30 23:35:57 +08:00
|
|
|
#### ConfirmEnvironment Properties
|
2020-02-04 13:23:36 +08:00
|
|
|
Properties of ConfirmEnvironment can be modified
|
|
|
|
|
|
|
|
|Name|Type|Description|
|
2020-01-30 18:48:38 +08:00
|
|
|
|-|-|-|
|
2020-01-30 23:35:57 +08:00
|
|
|
|type|`'error \| 'success' \| 'warning'`||
|
2020-02-05 23:49:59 +08:00
|
|
|
|title|`string \| function`|Can be a render function.|
|
2020-01-30 23:35:57 +08:00
|
|
|
|closable|`boolean`||
|
2020-02-04 13:23:36 +08:00
|
|
|
|icon|`function`|Should be a render function|
|
2020-02-05 23:49:59 +08:00
|
|
|
|negative-text|`string`||
|
|
|
|
|positive-text|`string`||
|
|
|
|
|content|`string \| function`|Can be a render function.|
|
2020-01-30 23:35:57 +08:00
|
|
|
|show-icon|`boolean`||
|
|
|
|
|loading|`boolean`||
|
|
|
|
|bordered|`boolean`||
|
2020-02-05 12:21:18 +08:00
|
|
|
|onPositiveClick|`(hide: function) => any`||
|
|
|
|
|onNegativeClick|`(hide: function) => any`||
|
|
|
|
|onClose|`(hide: function) => any`||
|
2020-01-30 23:35:57 +08:00
|
|
|
|
|
|
|
#### ConfirmEnvironment Methods
|
2020-02-04 13:23:36 +08:00
|
|
|
|Name|Parameters|Description|
|
2020-01-30 23:35:57 +08:00
|
|
|
|-|-|-|
|
|
|
|
|hide|`()`|Call this method can close the confirm|
|
2020-01-30 18:48:38 +08:00
|
|
|
|
|
|
|
## Props
|
|
|
|
### Confirm Props
|
|
|
|
|Name|Type|Default|Description|
|
|
|
|
|-|-|-|-|
|
|
|
|
|type|`'error \| 'success' \| 'warning'`|`'warning'`||
|
2020-02-05 23:49:59 +08:00
|
|
|
|title|`string \| function`|`null`|Can be a render function.|
|
2020-01-30 18:48:38 +08:00
|
|
|
|closable|`boolean`|`boolean`||
|
2020-02-04 13:23:36 +08:00
|
|
|
|icon|`function`|`null`|Should be a render function|
|
2020-02-05 23:49:59 +08:00
|
|
|
|negative-text|`string`|`null`||
|
|
|
|
|positive-text|`string`|`null`||
|
|
|
|
|content|`string \| function`|`null`|Can be a render function.|
|
2020-01-30 18:48:38 +08:00
|
|
|
|show-icon|`boolean`|`true`||
|
|
|
|
|loading|`boolean`|`false`||
|
|
|
|
|bordered|`boolean`|`false`||
|
|
|
|
|
|
|
|
## Events
|
|
|
|
### Confirm Events
|
|
|
|
|Name|Parameters|Description|
|
|
|
|
|-|-|-|
|
|
|
|
|positive-click|`()`||
|
|
|
|
|negative-click|`()`||
|
|
|
|
|close|`()`||
|
|
|
|
|
|
|
|
## Slots
|
|
|
|
### Confirm Slots
|
|
|
|
|Name|Parameters|Description|
|
|
|
|
|-|-|-|
|
|
|
|
|icon|`()`||
|
|
|
|
|header|`()`||
|
|
|
|
|default|`()`|Content|
|
2020-02-04 14:55:55 +08:00
|
|
|
|action|`()`||
|
2020-01-30 18:48:38 +08:00
|
|
|
|