Bind an event processing function in the component, for example, bindtap="handleTap".
<button bindtap="handleTap">test</button>
Write the event processing function in Page(). The parameter is the event object.
Page({
handleTap: function(event) {
console.info(event);
}
});
// Structure of the event object is as follows:
{
"type": "tap",
"timeStamp": 6925,
"target": {
"tagName": "Q-BUTTON",
"id": "",
"offsetLeft": 0,
"offsetTop": 0,
"dataset": {
}
},
"currentTarget": {
"id": "",
"offsetLeft": 0,
"offsetTop": 0,
"dataset": {
}
},
"touches": [
],
"changedTouches": [
{
"identifier": 0,
"pageX": 95.00000762939453,
"pageY": 21.10714340209961,
"clientX": 95.00000762939453,
"clientY": 21.10714340209961,
"force": 0
}
],
"detail": {
"x": 95.00000762939453,
"y": 21.10714340209961
},
"_vts": 1760344353394,
"syncModelOpt": {
}
}