This commit is contained in:
mohit-nagaraj 2024-10-08 08:23:07 +05:30
parent da831893de
commit e2ce0e38a6
No known key found for this signature in database
4 changed files with 68 additions and 4 deletions

View file

@ -42,6 +42,18 @@ export default {
mounted() { mounted() {
this.modal = new Modal(this.$refs.modal); this.modal = new Modal(this.$refs.modal);
}, },
watch: {
$route(to, from) {
this.cleanupModal();
}
},
beforeUnmount() {
this.cleanupModal();
},
beforeRouteLeave(to, from, next) {
this.cleanupModal();
next();
},
methods: { methods: {
/** /**
* Show the confirm dialog * Show the confirm dialog
@ -58,6 +70,22 @@ export default {
this.$emit("added", this.groupName); this.$emit("added", this.groupName);
this.modal.hide(); this.modal.hide();
}, },
/**
* Clean up modal and restore scroll behavior
* @returns {void}
*/
cleanupModal() {
if (this.modal) {
try {
this.modal.hide();
} catch (e) {
console.warn("Modal hide failed:", e);
}
}
document.body.classList.remove('modal-open');
document.body.style.paddingRight = '';
document.body.style.overflow = '';
}
}, },
}; };
</script> </script>

View file

@ -354,8 +354,11 @@ export default {
*/ */
cleanupModal() { cleanupModal() {
if (this.modal) { if (this.modal) {
try {
this.modal.hide(); this.modal.hide();
this.modal.dispose(); } catch (e) {
console.warn("Modal hide failed:", e);
}
} }
document.body.classList.remove('modal-open'); document.body.classList.remove('modal-open');
document.body.style.paddingRight = ''; document.body.style.paddingRight = '';

View file

@ -231,8 +231,11 @@ export default {
*/ */
cleanupModal() { cleanupModal() {
if (this.modal) { if (this.modal) {
try {
this.modal.hide(); this.modal.hide();
this.modal.dispose(); } catch (e) {
console.warn("Modal hide failed:", e);
}
} }
document.body.classList.remove('modal-open'); document.body.classList.remove('modal-open');
document.body.style.paddingRight = ''; document.body.style.paddingRight = '';

View file

@ -248,6 +248,20 @@ export default {
this.modal = new Modal(this.$refs.modal); this.modal = new Modal(this.$refs.modal);
this.getExistingTags(); this.getExistingTags();
}, },
beforeRouteLeave(to, from, next) {
this.cleanupModal();
next();
},
watch: {
$route(to, from) {
this.cleanupModal();
}
},
beforeUnmount() {
this.cleanupModal();
},
methods: { methods: {
/** /**
* Show the add tag dialog * Show the add tag dialog
@ -459,6 +473,22 @@ export default {
this.newTags = []; this.newTags = [];
this.deleteTags = []; this.deleteTags = [];
this.processing = false; this.processing = false;
},
/**
* Clean up modal and restore scroll behavior
* @returns {void}
*/
cleanupModal() {
if (this.modal) {
try {
this.modal.hide();
} catch (e) {
console.warn("Modal hide failed:", e);
}
}
document.body.classList.remove('modal-open');
document.body.style.paddingRight = '';
document.body.style.overflow = '';
} }
}, },
}; };