Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit e82bfb4

Browse files
committed
Emit modal changes
1 parent 34a6a3e commit e82bfb4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/components/tw-modal.vue

+10-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default defineComponent({
9595
directives: {
9696
trapFocus,
9797
},
98-
emits: ["close", "update:modelValue"],
98+
emits: ["close", "update:modelValue", "didopen", "willclose"],
9999
methods: {
100100
doCancel() {
101101
this.$emit("cancel")
@@ -128,6 +128,15 @@ export default defineComponent({
128128
created() {
129129
document?.addEventListener("keyup", this.keyPress)
130130
},
131+
watch: {
132+
modelValue(value) {
133+
if (value === true) {
134+
this.$emit("didopen")
135+
} else {
136+
this.$emit("willclose")
137+
}
138+
},
139+
},
131140
beforeMount() {
132141
// Insert the Dialog component in the element container
133142
if (this.standalone && typeof window !== "undefined") {

0 commit comments

Comments
 (0)