From 2302dc4206c6f70018725b920fbfcdf1e7576547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bahad=C4=B1r=20Sofuo=C4=9Flu?= Date: Tue, 3 Jan 2023 17:35:38 +0300 Subject: [PATCH] BlockScroll feature added --- components/sidebar/Sidebar.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/sidebar/Sidebar.vue b/components/sidebar/Sidebar.vue index 4d38ae9d2..4d0a8b328 100755 --- a/components/sidebar/Sidebar.vue +++ b/components/sidebar/Sidebar.vue @@ -64,7 +64,7 @@ export default { }, blockScroll: { type: Boolean, - default: false + default: true } }, maskClickListener: null, @@ -95,7 +95,9 @@ export default { methods: { hide() { this.$emit('update:visible', false); + this.outsideClickListener && this.unbindOutsideClickListener(); + this.blockScroll && DomHandler.removeClass(document.body, 'p-overflow-hidden'); }, onEnter() { this.$emit('show'); @@ -120,6 +122,10 @@ export default { }, onAfterEnter() { this.bindOutsideClickListener(); + + if (this.blockScroll) { + DomHandler.addClass(document.body, 'p-overflow-hidden'); + } }, focus() { const findFocusableElement = (container) => {