颓废市民小高
颓废市民小高
  • 发布:2019-06-19 17:57
  • 更新:2019-06-20 10:42
  • 阅读:1266

【超急】 :focus 在安卓无效,ios还没试

分类:uni-app

<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 无效

2019-06-19 17:57 负责人:无 分享
已邀请:
DCloud_UNI_HT

DCloud_UNI_HT

原生组件中 不能使用ref ,只有自定义组件中才能使用。

该问题目前已经被锁定, 无法添加新回复