input獲得焦點但是寫入不了內(nèi)容:
多個input時只能最后一個獲得焦點,不論點擊哪一個都是最后一個input獲得焦點
例子: zjl/zjl0/wx_s/login/login.wxml ? ? ?
解決辦法:
① wxml: ? input 添加
id , ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 為后面獲取這個值做準(zhǔn)備
focus="{{name_focus}}"?, ? ? ? ? ? ? ?true: 獲得焦點
bindchange="bindChange", ? ? ?change事件,獲得input value值
? ? ? bindtap="listenerPhoneInput" ?綁定操作事件
?
? ? ? ?js :
? ? ? data 參數(shù)內(nèi)設(shè)置?name_focus
? ?
?
listenerPhoneInput:?function(e){? //?用戶名input? 獲得焦點。愛掏網(wǎng) - it200.com?可填寫內(nèi)容
? ? this.setData({
? ? ? ? name_focus:?true,
? ? ? ? user_name:?e.detail.value
? ? });}
},
bindChange:?function(e){? ?//? 存入input用戶名,密碼
? ? inputContent[e.currentTarget.id]?=?e.detail.value
},
多個input時只能最后一個獲得焦點,不論點擊哪一個都是最后一個input獲得焦點
例子: zjl/zjl0/wx_s/login/login.wxml ? ? ?
解決辦法:
① wxml: ? input 添加
id , ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 為后面獲取這個值做準(zhǔn)備
focus="{{name_focus}}"?, ? ? ? ? ? ? ?true: 獲得焦點
bindchange="bindChange", ? ? ?change事件,獲得input value值
? ? ? bindtap="listenerPhoneInput" ?綁定操作事件
?
? ? ? ?js :
? ? ? data 參數(shù)內(nèi)設(shè)置?name_focus
listenerPhoneInput:?function(e){? //?用戶名input? 獲得焦點。愛掏網(wǎng) - it200.com?可填寫內(nèi)容
? ? this.setData({
? ? ? ? name_focus:?true,
? ? ? ? user_name:?e.detail.value
? ? });}
},
bindChange:?function(e){? ?//? 存入input用戶名,密碼
? ? inputContent[e.currentTarget.id]?=?e.detail.value
},
聲明:所有內(nèi)容來自互聯(lián)網(wǎng)搜索結(jié)果,不保證100%準(zhǔn)確性,僅供參考。如若本站內(nèi)容侵犯了原著者的合法權(quán)益,可聯(lián)系我們進(jìn)行處理。