想要获取用户输入的搜索框的值,并传至另一页面。
<input type="text" placeholder="搜索公交线路、站台" confirm-type="search" bindtap="input" value="{{searchvalue}}" bindconfirm="search" ></input>
<button bindtap="search" value="{{searchvalue}}">搜索</button>
search:function(e){
let searchvalue = e.currentTarget.dataset.searchvalue;
console.log(e.currentTarget.dataset.searchvalue);
wx.navigateTo({
url: '../search/search?searchvalue='+ searchvalue
})
},
bindinput or bindblur
document: https://developers.weixin.qq.com/miniprogram/dev/component/input.html