页面有多个input组件,如何在一个组件里面点击next的时候 自动聚焦到下一个的组件?键盘不能闪动,我的实现方式有bug,不知怎么解决
< form bindsubmit = "formSubmit" wx:if = "{{!cbMsgToggle}}" >
< image style = 'width:100%;' src = '../../images/getprice.jpg' mode = 'widthFix' ></ image >
< view class = 'font-h3 center' >免费获取装修报价</ view >
< view class = "area" >
< view class = "weui-flex" >
< view class = 'weui-flex__item weui-btn tri-left' bindtap = 'showPicker' >< input name = 'location' type = 'hidden' value = '{{areaPicker.address}}' ></ input >{{areaPicker.address}}</ view >
< view class = 'weui-flex__item rel' >< input class = 'weui-input' name = 'acreage' type = 'text' placeholder = '面积' confirm-type = 'next' cursor-spacing = '172' id = '0' bindconfirm = 'nextBlur' focus = '{{false}}' confirm-hold></ input >< text class = 'abs' >m²</ text ></ view >
</ view >
< view class = 'weui-flex' >
< view class = 'weui-flex__item' >< input class = 'weui-input' name = 'fullname' type = 'text' placeholder = '姓名' confirm-type = 'next' cursor-spacing = '126' id = '1' bindconfirm = 'nextBlur' focus = '{{blurId == 1 ? true : false }}' confirm-hold></ input ></ view >
</ view >
< view class = 'weui-flex' >
< view class = 'weui-flex__item' >< input class = 'weui-input' name = 'phone' type = 'text' placeholder = '手机号' confirm-type = 'done' cursor-spacing = '80' id = '2' bindconfirm = 'formSubmit' focus = '{{blurId == 2 ? true : false }}' confirm-hold></ input ></ view >
</ view >
< import src = "../../tmpl/areaPicker/index.wxml" />
< template wx:if = "{{areaToggle}}" is = "areaPicker" data = "{{...areaPicker}}" />
</ view >
< view class = "btn-area" >
< button class = "weui-btn" type = "primary" formType = "submit" >马上获取</ button >
</ view >
< view class = 'font-h5 center' >*为了您的权益,您的隐私将被严格保密</ view >
</ form >
|
data: {
userInfo: {},
logged: false ,
takeSession: false ,
requestResult: '' ,
areaToggle: false ,
cbMsg: {},
cbMsgToggle: false ,
blurId: 0
},
closeCbMsg: function () {
this .setData({
cbMsgToggle: false ,
cbMsg: {},
blurId: 0
})
},
nextBlur: function (e) {
console.log(e)
this .setData({
blurId: Number(e.target.id)+1
})
console.log( this .data.blurId)
},
|
从面积框到姓名框正常,
从姓名框到手机框时,键盘就收起来了,也就是失去光标了,不知