Page({ data:{ focus:false, inputValue:"", e_focus: 'e_focus', e_blur: 'e_blur', e_confirm: 'e_confirm', e_keyboardheightchange: 'e_keyboardheightchange', e_input: 'e_input'
}, bindButtonTap:function(){ this.setData({ focus:true }) }, bindKeyInput:function(e){ this.setData({ inputValue:e.detail.value, e_input: JSON.stringify(e.detail) }) }, bindReplaceInput:function(e){ var value = e.detail.value; var pos = e.detail.cursor; if(pos != -1){ var left = e.detail.value.slice(0,pos); pos = left.replace(/11/g,'2').length; }
return { value:value.replace(/11/g,'2'), cursor:pos }
}, bindHideKeyboard:function(e){ if(e.detail.value === "123"){ wx.hideKeyboard(); } }, bindfocus(event){ console.log("聚焦了", event.detail); this.setData({ e_focus: JSON.stringify(event.detail) }) }, bindblur(event){ console.log("失去焦点", event.detail); this.setData({ e_blur: JSON.stringify(event.detail) }) }, bindconfirm(event) { console.log("confirm", event.detail); this.setData({ e_confirm: JSON.stringify(event.detail) }) }, bindkeyboardheightchange(event) { console.log("keyboardheightchange", event.detail); this.setData({ e_keyboardheightchange: JSON.stringify(event.detail) }) } })
|