From 11a22a2e0a0ed8dc8a9e5c17bc8ec34f96c74229 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Fri, 2 Feb 2024 15:46:45 +0000 Subject: [PATCH] Refactor #4953 - For Chips --- components/lib/chips/Chips.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/lib/chips/Chips.vue b/components/lib/chips/Chips.vue index feb7ea7cc..9b79958b3 100755 --- a/components/lib/chips/Chips.vue +++ b/components/lib/chips/Chips.vue @@ -67,12 +67,20 @@ export default { emits: ['update:modelValue', 'add', 'remove', 'focus', 'blur'], data() { return { - id: UniqueComponentId(), + id: this.$attrs.id, inputValue: null, focused: false, focusedIndex: null }; }, + watch: { + '$attrs.id': function (newValue) { + this.id = newValue || UniqueComponentId(); + } + }, + mounted() { + this.id = this.id || UniqueComponentId(); + }, methods: { onWrapperClick() { this.$refs.input.focus();