diff --git a/src/App.vue b/src/App.vue index 50efe73..4cdba81 100644 --- a/src/App.vue +++ b/src/App.vue @@ -221,6 +221,7 @@ export default { title: "Alert", icon: "", message: "", + backgroundDismissable: false, callback() {}, }, @@ -1486,7 +1487,7 @@ export default { */ // Generic window.alert replacement modal. - async modalAlert({ message, title="Alert", icon="", isConfirm=false }) { + async modalAlert({ message, title="Alert", icon="", isConfirm=false, backgroundDismissable=false }) { return new Promise((resolve, reject) => { this.alertModal.isConfirm = isConfirm; this.alertModal.title = title; @@ -1495,6 +1496,7 @@ export default { this.alertModal.callback = () => { resolve(); }; + this.alertModal.backgroundDismissable = backgroundDismissable; this.alertModal.visible = true; }); }, @@ -2409,6 +2411,7 @@ export default { :title="alertModal.title" :icon="alertModal.icon" :message="alertModal.message" + :background-dismissable="alertModal.backgroundDismissable" @callback="alertModal.callback" @close="modalClose()"> @@ -3315,7 +3318,7 @@ export default { Ignore unsolicited DMs diff --git a/src/components/AlertModal.vue b/src/components/AlertModal.vue index 0a68271..d2038aa 100644 --- a/src/components/AlertModal.vue +++ b/src/components/AlertModal.vue @@ -6,6 +6,7 @@ export default { title: String, icon: String, message: String, + backgroundDismissable: Boolean, }, data() { return { @@ -32,14 +33,19 @@ export default { }, close() { this.$emit('close'); - } + }, + backgroundClicked() { + if (this.backgroundDismissable) { + this.close(); + } + }, } }