官方文档: https://developers.weixin.qq.com/miniprogram/dev/extended/weui/search.html
onLoad 里面这句 this.search.bind(this) 是什么含义和作用呢? bind 是个啥鬼? 谢谢
Page({
data: {
inputShowed: false,
inputVal: ""
},
onLoad() {
this.setData({
search: this.search.bind(this)
})
},
search: function (value) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve([{ text: '搜索结果', value: 1 }, { text: '搜索结果2', value: 2 }])
}, 200)
})
},
selectResult: function (e) {
console.log('select result', e.detail)
},