input组件,试图实现的效果:
* input组件中,placeholder居中,输入内容也居中
* 点击input组件focus后,placeholder消失,输入光标居中开始输入
* 如果不输入任何内容,blur时重新出现placeholder
Page{ data : { placeholder: "" },
this .setData({placeholder: "" }) }, onInputBlur: function (e){ this .setData({placeHolder: this .promptText}) }, onLoad: function (opt){ this .onInputBlur() } } |
WXML:
< input bindblur = "onInputBlur" bindfocus = "onInputfocus" confirm-type = "go" bindconfirm = "checkAccess" bindinput = "setAccess" maxlength = "31" placeholder-style = "text-align:center;" placeholder = "{{placeholder}}" type = "text" /> |
* bug表现
在安卓下,点击input,bindfocus函数内设置placeholder无效。