小程序获取input某一个的值

没有form的input点击按钮获取input的值 不是通过input事件获取

例如:

<input class="weui-search-bar__input" placeholder="搜索" value="{{inputVal}}" focus="{{inputShowed}}" >

<button type="primary"  bindtap="butsubmit">搜索</button> 

可以在data内设置inputVal变量 ,当点击搜索时触法函数butsubmit获取

data: {
    inputVal: ""
  },
butsubmit:function(e){
    console.log(this.data.inputVal)
  },


猜你喜欢

转载自blog.csdn.net/sym134/article/details/80369972