diff --git a/src/components/SelectionManager.vue b/src/components/SelectionManager.vue index 087998a3..cdf1a8a9 100644 --- a/src/components/SelectionManager.vue +++ b/src/components/SelectionManager.vue @@ -203,14 +203,13 @@ export default defineComponent({ ]; }, + beforeDestroy() { + this.setHasTopBar(false); + }, + watch: { - show() { - const klass = 'has-top-bar'; - if (this.show) { - document.body.classList.add(klass); - } else { - document.body.classList.remove(klass); - } + show(value: boolean) { + this.setHasTopBar(value); }, }, @@ -269,6 +268,11 @@ export default defineComponent({ this.size = this.selection.size; }, + /** Set the has-top-bar class on the body */ + setHasTopBar(has: boolean) { + document.body.classList.toggle('has-top-bar', has); + }, + /** Is this fileid (or anything if not specified) selected */ has(fileid?: number) { if (fileid === undefined) {