微信小程序获取input值的方法
示例代码如下:
wxml:
<input class='searchInput' placeholder='请输入关键字...' name="inputValue" bindinput='searchInput'></input>
js:
searchInput: function(e){
this.setData({
inputValue: e.detail.value
})
},
这个只是将input里的值存进了inputValue变量中,若是要取它的值,可直接利用this.data.inputValue来取。
还没有评论,来说两句吧...