breaking change(Dialog): adjust before-close usage

This commit is contained in:
chenjiahan
2020-09-06 10:16:54 +08:00
parent c9f0f11028
commit 21c30cbbf8
6 changed files with 49 additions and 34 deletions
+7 -8
View File
@@ -72,13 +72,12 @@ Dialog.alert({
### Asnyc Close
```js
function beforeClose(action, done) {
if (action === 'confirm') {
setTimeout(done, 1000);
} else {
done();
}
}
const beforeClose = (action, done) =>
new Promsie((resolve) => {
setTimeout(() => {
resolve(action === 'confirm');
}, 1000);
});
Dialog.confirm({
title: 'Title',
@@ -185,7 +184,7 @@ export default {
| lazy-render | Whether to lazy render util appeared | _boolean_ | `true` |
| lock-scroll | Whether to lock background scroll | _boolean_ | `true` |
| allow-html `v2.8.7` | Whether to allow HTML rendering in message | _boolean_ | `true` |
| before-close | Callback before close,<br>call done() to close dialog,<br>call done(false) to cancel loading | (action: string, done: Function) => void | - |
| before-close | Callback before close | _(action) => boolean \| Promise_ | - |
| transition | Transition, equivalent to `name` prop of [transtion](https://vuejs.org/v2/api/#transition) | _string_ | - |
| teleport | Return the mount node for Dialog | _string \| Element_ | - |