|
@@ -38,6 +38,13 @@
|
|
|
methods: {
|
|
|
openDialog() {
|
|
|
this.$refs.dialogBind.open();
|
|
|
+ },
|
|
|
+ handleClose(done) {
|
|
|
+ this.$confirm('Are you sure to close this dialog?')
|
|
|
+ .then(_ => {
|
|
|
+ done();
|
|
|
+ })
|
|
|
+ .catch(_ => {});
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -51,12 +58,16 @@ Informs users while preserving the current page state.
|
|
|
|
|
|
Dialog pops up a dialog box, and it's quite customizable.
|
|
|
|
|
|
-:::demo Set the `v-model` attribute with a `Boolean`, and Dialog shows when it is `true`. The Dialog has two parts: `body` and `footer`, and the latter requires a `slot` named `footer`. The optional `title` attribute (empty by default) is for defining a title. This example explicitly changes the value of `v-model` to toggle Dialog. In addition, we also provide `open` and `close` method, which you can call to open/close the Dialog.
|
|
|
+:::demo Set the `v-model` attribute with a `Boolean`, and Dialog shows when it is `true`. The Dialog has two parts: `body` and `footer`, and the latter requires a `slot` named `footer`. The optional `title` attribute (empty by default) is for defining a title. This example explicitly changes the value of `v-model` to toggle Dialog. In addition, we also provide `open` and `close` method, which you can call to open/close the Dialog. Finally, this example demonstrates how `before-close` is used.
|
|
|
|
|
|
```html
|
|
|
<el-button type="text" @click="dialogVisible = true">click to open the Dialog</el-button>
|
|
|
|
|
|
-<el-dialog title="Tips" v-model="dialogVisible" size="tiny">
|
|
|
+<el-dialog
|
|
|
+ title="Tips"
|
|
|
+ v-model="dialogVisible"
|
|
|
+ size="tiny"
|
|
|
+ :before-close="handleClose">
|
|
|
<span>This is a message</span>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogVisible = false">Cancel</el-button>
|
|
@@ -70,6 +81,15 @@ Dialog pops up a dialog box, and it's quite customizable.
|
|
|
return {
|
|
|
dialogVisible: false
|
|
|
};
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleClose(done) {
|
|
|
+ this.$confirm('Are you sure to close this dialog?')
|
|
|
+ .then(_ => {
|
|
|
+ done();
|
|
|
+ })
|
|
|
+ .catch(_ => {});
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
@@ -170,6 +190,7 @@ The content of Dialog can be anything, even a table or a form. This example show
|
|
|
| close-on-click-modal | whether the Dialog can be closed by clicking the mask | boolean | — | true |
|
|
|
| close-on-press-escape | whether the Dialog can be closed by pressing ESC | boolean | — | true |
|
|
|
| show-close | whether to show a close button | boolean | — | true |
|
|
|
+| before-close | callback before Dialog closes, and it will prevent Dialog from closing | function(done),done is used to close the Dialog | — | — |
|
|
|
|
|
|
### Slot
|
|
|
|