Merge pull request #2933 from bahadirsofuoglu/Password-default-value-bug
Password component default value display issue fixedpull/3732/head
commit
313407d67f
|
@ -100,6 +100,9 @@ export default {
|
|||
this.infoText = this.promptText;
|
||||
this.mediumCheckRegExp = new RegExp(this.mediumRegex);
|
||||
this.strongCheckRegExp = new RegExp(this.strongRegex);
|
||||
if(this.value){
|
||||
this.d_value = this.value;
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.restoreAppend();
|
||||
|
@ -166,6 +169,7 @@ export default {
|
|||
onFocus(event) {
|
||||
this.focused = true;
|
||||
if (this.feedback) {
|
||||
this.setPasswordMeter()
|
||||
this.overlayVisible = true;
|
||||
}
|
||||
this.$emit('focus', event);
|
||||
|
@ -180,9 +184,34 @@ export default {
|
|||
onKeyUp(event) {
|
||||
if (this.feedback) {
|
||||
let value = event.target.value;
|
||||
let label = null;
|
||||
let meter = null;
|
||||
switch (this.testStrength(value)) {
|
||||
|
||||
const {meter,label} = this.checkPasswordStrength(value);
|
||||
|
||||
this.meter = meter;
|
||||
this.infoText = label;
|
||||
if (!this.overlayVisible) {
|
||||
this.overlayVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.$emit('keyup', event);
|
||||
},
|
||||
setPasswordMeter() {
|
||||
if(!this.feedback || !this.d_value) return;
|
||||
|
||||
const {meter,label} = this.checkPasswordStrength(this.d_value);
|
||||
|
||||
this.meter = meter;
|
||||
this.infoText = label;
|
||||
|
||||
if (!this.overlayVisible) {
|
||||
this.overlayVisible = true;
|
||||
}
|
||||
},
|
||||
checkPasswordStrength(value) {
|
||||
let label = null;
|
||||
let meter = null;
|
||||
switch (this.testStrength(value)) {
|
||||
case 1:
|
||||
label = this.weakText;
|
||||
meter = {
|
||||
|
@ -208,15 +237,9 @@ export default {
|
|||
label = this.promptText;
|
||||
meter = null;
|
||||
break;
|
||||
}
|
||||
this.meter = meter;
|
||||
this.infoText = label;
|
||||
if (!this.overlayVisible) {
|
||||
this.overlayVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.$emit('keyup', event);
|
||||
return { label, meter };
|
||||
},
|
||||
bindScrollListener() {
|
||||
if (!this.scrollHandler) {
|
||||
|
|
Loading…
Reference in New Issue