<input type='number' maxlength='4' :focus='focusShow' ref='aaa' @blur='loseBlur' :value='boxCode' @input='numberChange'></input>
<view class='phone-srk' @click.stop='showKeyboard' ></view>
showKeyboard: function(e) {
this.focusShow = true
console.log(this.$refs['aaa'].,this.$refs['aaa'].focus())
console.log(111,this.focusShow)
},
numberChange: function(e) {
console.log(3122)
var value = e.detail.value;
console.log(value)
var arr = value.split('');
this.boxcodearr = arr,
this.boxCode = value
this.judgeFocus();
if (this.boxCode.length == 4) {
this.bindPhone();
} else {
}
},
点击 showKeyboard打印出来this.$refs['aaa'].是undefined ,this.$refs['aaa'].focus()报错,111,true
numberChange 完全没反应,连3122都没有
我直接numberChange 都是正常,就是说明 :focus 无效
颓废市民小高 (作者)
:focus不支持我才使用的ref
2019-06-20 14:20
颓废市民小高 (作者)
有没有解决方案呀。。。
2019-06-20 15:18