From 1e8903644cf982c73438325673ad37a57b3db80b Mon Sep 17 00:00:00 2001 From: mertsincan Date: Fri, 2 Feb 2024 15:47:17 +0000 Subject: [PATCH] Refactor #4953 - For Fieldset --- components/lib/fieldset/Fieldset.vue | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/components/lib/fieldset/Fieldset.vue b/components/lib/fieldset/Fieldset.vue index 02e811465..f15ffceae 100755 --- a/components/lib/fieldset/Fieldset.vue +++ b/components/lib/fieldset/Fieldset.vue @@ -2,15 +2,15 @@
- {{ legend }} + {{ legend }} -
+
@@ -48,14 +48,21 @@ export default { emits: ['update:collapsed', 'toggle'], data() { return { + id: this.$attrs.id, d_collapsed: this.collapsed }; }, watch: { + '$attrs.id': function (newValue) { + this.id = newValue || UniqueComponentId(); + }, collapsed(newValue) { this.d_collapsed = newValue; } }, + mounted() { + this.id = this.id || UniqueComponentId(); + }, methods: { toggle(event) { this.d_collapsed = !this.d_collapsed; @@ -73,9 +80,6 @@ export default { } }, computed: { - ariaId() { - return UniqueComponentId(); - }, buttonAriaLabel() { return this.toggleButtonProps && this.toggleButtonProps.ariaLabel ? this.toggleButtonProps.ariaLabel : this.legend; }