[UI] Added visible property to ConfirmDialog element.

This commit is contained in:
Fabio Manganiello 2024-08-25 00:12:42 +02:00
parent 8b3c2a8ee1
commit 8f2e68f0db
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -1,5 +1,5 @@
<template>
<Modal ref="modal" :title="title" @close="close">
<Modal ref="modal" :visible="visible" :title="title" @close="close">
<div class="dialog-content">
<slot />
</div>
@ -35,6 +35,11 @@ export default {
type: String,
default: "Cancel",
},
visible: {
type: Boolean,
default: false,
},
},
methods: {
@ -44,11 +49,11 @@ export default {
},
open() {
this.$refs.modal.show()
this.$refs.modal?.show()
},
close() {
this.$refs.modal.hide()
this.$refs.modal?.hide()
this.$emit('close')
},
@ -60,6 +65,19 @@ export default {
this.close()
},
},
watch: {
visible: {
immediate: true,
handler(val) {
if (val) {
this.open()
} else {
this.close()
}
},
},
},
}
</script>