Skip to content

Commit cf08c59

Browse files
authored
Merge pull request #162 from devforth/afcl-dialog
feat: add open and close methods for dialog component
2 parents 2157cf7 + dd4cfb8 commit cf08c59

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

adminforth/documentation/docs/tutorial/03-Customization/15-afcl.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,23 @@ Default behavior of the Dialog component will allow user to close it by just cli
519519
</div>
520520
</div>
521521

522+
### Dialog open and close
523+
524+
You can open and close dialog by calling `open` and `close` methods.
525+
526+
```ts
527+
528+
const confirmDialog = ref(null);
529+
530+
const openDialog = () => {
531+
confirmDialog.value.open();
532+
}
533+
534+
const closeDialog = () => {
535+
confirmDialog.value.close();
536+
}
537+
```
538+
522539
## Dropzone
523540

524541
```ts

adminforth/spa/src/afcl/Dialog.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,17 @@ onUnmounted(() => {
9898
modal.value?.destroy();
9999
})
100100
101+
function open() {
102+
modal.value?.show();
103+
}
104+
105+
function close() {
106+
modal.value?.hide();
107+
}
108+
109+
defineExpose({
110+
open: open,
111+
close: close,
112+
})
113+
101114
</script>

0 commit comments

Comments
 (0)