How applet to obtain information element click, click on the element object

Use hump mode, click on the element is bound to the data - ***, obtained by event.currentTarget.dataset

Example:

<image bindtap="tap" data-message="{{ item }}"   src="{{ item.mini_pic }}" class="{{ item.show_opacity ? 'show_opacity' : ''}}" >
</image>

// 获取的点击节点元素是一个对象
 tap: function(event) {
    var message = event.currentTarget.dataset.message;
}

Guess you like

Origin www.cnblogs.com/shipskunkun/p/11802527.html