password-virtual-keyboard-vue
Advanced tools
Comparing version 1.0.6 to 1.0.7
{ | ||
"name": "password-virtual-keyboard-vue", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "author": "潮水哥 <fcy998@hotmail.com>", |
@@ -10,2 +10,4 @@ # password-virtual-keyboard-vue | ||
1.0.7 *新增明/密文显示按钮,新增输入光标显示 | ||
1.0.6 *修复列表样式问题 | ||
@@ -45,3 +47,3 @@ | ||
<div id="app"> | ||
<Keyboard @complete="getResult" @changeInputValue="changeValue" :inputNum="6"></Keyboard> | ||
<Keyboard @complete="getResult" @changeInputValue="changeValue" :inputNum="6" :showClear="true"></Keyboard> | ||
</div> | ||
@@ -64,1 +66,10 @@ </template> | ||
``` | ||
##### 参数说明 | ||
``` | ||
@complete | Function | 点击完成按钮触发 | ||
@changeInputValue | Function | 点击按键输入时触发 | ||
:inputNum | Number | 可定义密码长度,默认为6个 | ||
:showClear | Boolean | 可设置是否显示明/密文按钮,默认为false | ||
``` |
@@ -26,3 +26,5 @@ import {keyCodes} from './keyboard.data' | ||
isEnter:false, | ||
isShowKeyboard:false | ||
isShowKeyboard:false, | ||
isClear:'password', | ||
cursorIndex:-1 | ||
} | ||
@@ -34,2 +36,6 @@ }, | ||
default:6 | ||
}, | ||
showClear:{ | ||
type:Boolean, | ||
default:false | ||
} | ||
@@ -41,3 +47,3 @@ }, | ||
let typeArray = ['lowercase','symbols','capital'] | ||
typeArray.includes(keyType) ? res = 'letters-code' : res = '' | ||
res = typeArray.includes(keyType) ? 'letters-code' : '' | ||
return res | ||
@@ -51,2 +57,3 @@ } | ||
this.isShowKeyboard = false | ||
this.cursorIndex = -1 | ||
}) | ||
@@ -73,2 +80,3 @@ }, | ||
if(this.keyCodeArr.length < this.inputNum){ | ||
this.cursorIndex++ | ||
this.keyCodeArr.push(code) | ||
@@ -87,2 +95,3 @@ this.keyCodeArr.forEach((ele,index) => { | ||
if(this.keyCodeArr.length != 0){ | ||
this.cursorIndex-- | ||
this.inputList[this.keyCodeArr.length-1].value = '' | ||
@@ -97,2 +106,3 @@ this.keyCodeArr.splice((this.keyCodeArr.length-1),1) | ||
this.keyCodeArr = [] | ||
this.cursorIndex = 0 | ||
this.inputList.forEach(val=>val.value ='') | ||
@@ -108,9 +118,18 @@ this.isEnter = false | ||
this.isShowKeyboard = false | ||
this.cursorIndex = -1 | ||
this.$emit('complete',res) | ||
} | ||
}, | ||
showClearEvent(){ | ||
this.isClear = this.isClear === 'password' ? 'text' : 'password' | ||
}, | ||
showKeyboard(){ | ||
this.isShowKeyboard = true | ||
if(this.keyCodeArr.length != 0 && this.cursorIndex <= this.keyCodeArr.length){ | ||
this.cursorIndex = this.keyCodeArr.length | ||
}else{ | ||
this.cursorIndex = 0 | ||
} | ||
} | ||
}, | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
401790
18
680
73