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