refactor: #7090 for Password

pull/7064/merge
Mert Sincan 2025-01-14 11:12:33 +00:00
parent 2f27d08642
commit 78e1d46340
1 changed files with 2 additions and 9 deletions

View File

@ -70,7 +70,7 @@
<script> <script>
import { absolutePosition, addStyle, getOuterWidth, isTouchDevice, relativePosition } from '@primeuix/utils/dom'; import { absolutePosition, addStyle, getOuterWidth, isTouchDevice, relativePosition } from '@primeuix/utils/dom';
import { ZIndex } from '@primeuix/utils/zindex'; import { ZIndex } from '@primeuix/utils/zindex';
import { ConnectedOverlayScrollHandler, UniqueComponentId } from '@primevue/core/utils'; import { ConnectedOverlayScrollHandler } from '@primevue/core/utils';
import EyeIcon from '@primevue/icons/eye'; import EyeIcon from '@primevue/icons/eye';
import EyeSlashIcon from '@primevue/icons/eyeslash'; import EyeSlashIcon from '@primevue/icons/eyeslash';
import InputText from 'primevue/inputtext'; import InputText from 'primevue/inputtext';
@ -88,7 +88,6 @@ export default {
}, },
data() { data() {
return { return {
id: this.$attrs.id,
overlayVisible: false, overlayVisible: false,
meter: null, meter: null,
infoText: null, infoText: null,
@ -96,18 +95,12 @@ export default {
unmasked: false unmasked: false
}; };
}, },
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
mediumCheckRegExp: null, mediumCheckRegExp: null,
strongCheckRegExp: null, strongCheckRegExp: null,
resizeListener: null, resizeListener: null,
scrollHandler: null, scrollHandler: null,
overlay: null, overlay: null,
mounted() { mounted() {
this.id = this.id || UniqueComponentId();
this.infoText = this.promptText; this.infoText = this.promptText;
this.mediumCheckRegExp = new RegExp(this.mediumRegex); this.mediumCheckRegExp = new RegExp(this.mediumRegex);
this.strongCheckRegExp = new RegExp(this.strongRegex); this.strongCheckRegExp = new RegExp(this.strongRegex);
@ -321,7 +314,7 @@ export default {
return this.promptLabel || this.$primevue.config.locale.passwordPrompt; return this.promptLabel || this.$primevue.config.locale.passwordPrompt;
}, },
overlayUniqueId() { overlayUniqueId() {
return this.id + '_overlay'; return this.$id + '_overlay';
} }
}, },
components: { components: {