html:
<div class="w_next clear">
<span class="marginR_10 margin_b15">输入密码</span>
<div class="keyWord">
<input type="text" maxlength="1" autofocus="autofocus" v-for="(xx,index) in 6" @keyup="key(index)" >
</div>
</div>
js:
key:function(index){
var aInput=$(".keyWord input");
if(aInput[index].value==""){
if(index==0){
return;
}
aInput[index-1].removeAttribute("readonly");
aInput[index-1].value="";
aInput[index-1].focus();
return;
}
if(index+1>aInput.length-1){
return;
}
aInput[index+1].focus();
aInput[index].setAttribute("readonly",true)
},