From ae45937af59b1b6d4fabd836be1936112efee66e Mon Sep 17 00:00:00 2001 From: mertsincan Date: Fri, 2 Feb 2024 15:47:51 +0000 Subject: [PATCH] Refactor #4953 - For ScrollPanel --- components/lib/scrollpanel/ScrollPanel.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/lib/scrollpanel/ScrollPanel.vue b/components/lib/scrollpanel/ScrollPanel.vue index 5f57d43c7..48fa5ab8d 100644 --- a/components/lib/scrollpanel/ScrollPanel.vue +++ b/components/lib/scrollpanel/ScrollPanel.vue @@ -61,13 +61,20 @@ export default { outsideClickListener: null, data() { return { - id: UniqueComponentId(), + id: this.$attrs.id, orientation: 'vertical', lastScrollTop: 0, lastScrollLeft: 0 }; }, + watch: { + '$attrs.id': function (newValue) { + this.id = newValue || UniqueComponentId(); + } + }, mounted() { + this.id = this.id || UniqueComponentId(); + if (this.$el.offsetParent) { this.initialize(); } @@ -362,7 +369,7 @@ export default { }, computed: { contentId() { - return UniqueComponentId() + '_content'; + return this.id + '_content'; } } };