[Improvement] Dialog: add before-close prop (#881)

This commit is contained in:
neverland
2018-04-17 14:16:28 +08:00
committed by GitHub
parent f87dd825d7
commit 6d74198e27
7 changed files with 82 additions and 51 deletions

View File

@@ -77,6 +77,7 @@ export default {
| overlay | Whether to show overlay | `Boolean` | `true` | - |
| closeOnClickOverlay | Whether to close when click overlay | `Boolean` | `false` | - |
| lockScroll | Whether to lock body scroll | `Boolean` | `true` | - |
| beforeClose | Callback before closecall done to close dialog | (action: string, done: function) => void | - | - |
#### Advanced Usage
If you need to render vue components within a dialog, you can use dialog component.
@@ -110,12 +111,12 @@ export default {
},
methods: {
onClickConfirmAsync() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, 1000)
})
beforeClose() {
if (action === 'confirm') {
setTimeout(done, 1000);
} else {
done();
}
}
}
}
@@ -136,6 +137,7 @@ export default {
| overlay | Whether to show overlay | `Boolean` | `true` | - |
| close-on-click-overlay | Whether to close when click overlay | `Boolean` | `false` | - |
| lock-scroll | Whether to lock background scroll | `Boolean` | `true` | - |
| before-close | Callback before closecall done to close dialog | (action: string, done: function) => void | - | - |
### Event