From 2b1b235f5e86f412c7763f72d92af6de85ffc408 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Fri, 2 Feb 2024 15:47:44 +0000 Subject: [PATCH] Refactor #4953 - For Password --- components/lib/password/Password.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/lib/password/Password.vue b/components/lib/password/Password.vue index c236f94f18..8d05ef0eff 100755 --- a/components/lib/password/Password.vue +++ b/components/lib/password/Password.vue @@ -67,6 +67,7 @@ export default { emits: ['update:modelValue', 'change', 'focus', 'blur', 'invalid'], data() { return { + id: this.$attrs.id, overlayVisible: false, meter: null, infoText: null, @@ -74,12 +75,18 @@ export default { unmasked: false }; }, + watch: { + '$attrs.id': function (newValue) { + this.id = newValue || UniqueComponentId(); + } + }, mediumCheckRegExp: null, strongCheckRegExp: null, resizeListener: null, scrollHandler: null, overlay: null, mounted() { + this.id = this.id || UniqueComponentId(); this.infoText = this.promptText; this.mediumCheckRegExp = new RegExp(this.mediumRegex); this.strongCheckRegExp = new RegExp(this.strongRegex); @@ -291,7 +298,7 @@ export default { return this.promptLabel || this.$primevue.config.locale.passwordPrompt; }, panelUniqueId() { - return UniqueComponentId() + '_panel'; + return this.id + '_panel'; } }, components: {