1.點(diǎn)擊事件
bindtap 綁定事件 :所有層都可觸發(fā)
catchtap 綁定事件: 只有最頂層可觸發(fā)
2.事件event
currentTarget: 當(dāng)前組件
target: 事件源組件
currentTarget.dataSet: 數(shù)據(jù)
<view class="view1" bindtap="view1click" id="view1" data-title="新聞標(biāo)題" data-id="100">
dataset:Object
id:"100"
title:"新聞標(biāo)題"
3.輸入框綁定輸入事件 bindinput ,
<input placeholder="請輸入.." bindinput="input" />
取出輸入框當(dāng)前的 值
this.setData({expressNu: event.detail.value})
4.回調(diào)函數(shù)中,無法獲取 this
btnClick: function() {
var thispage = this; //..
app.getExpressInfo(this.data.expressNu,function(data) {
//把值傳給當(dāng)前頁面的變量
thispage.setData({expressInfo: data});
})
}