From 05752609119adb30e7ea0cd3a100d1401a80a711 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Fri, 2 Feb 2024 15:48:06 +0000 Subject: [PATCH] Refactor #4953 - For TreeSelect --- components/lib/treeselect/TreeSelect.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/lib/treeselect/TreeSelect.vue b/components/lib/treeselect/TreeSelect.vue index 901705947..ca1b98323 100644 --- a/components/lib/treeselect/TreeSelect.vue +++ b/components/lib/treeselect/TreeSelect.vue @@ -120,12 +120,16 @@ export default { emits: ['update:modelValue', 'before-show', 'before-hide', 'change', 'show', 'hide', 'node-select', 'node-unselect', 'node-expand', 'node-collapse', 'focus', 'blur'], data() { return { + id: this.$attrs.id, focused: false, overlayVisible: false, expandedKeys: {} }; }, watch: { + '$attrs.id': function (newValue) { + this.id = newValue || UniqueComponentId(); + }, modelValue: { handler: function () { if (!this.selfChange) { @@ -161,6 +165,7 @@ export default { } }, mounted() { + this.id = this.id || UniqueComponentId(); this.updateTreeState(); }, methods: { @@ -487,7 +492,7 @@ export default { return !this.options || this.options.length === 0; }, listId() { - return UniqueComponentId() + '_list'; + return this.id + '_list'; } }, components: {