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