diff --git a/components/lib/password/Password.vue b/components/lib/password/Password.vue index c236f94f1..8d05ef0ef 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: {