<view data-id='2' bindtap='getid'></view>

getid:function:(options){

var id = options.currentTarget.dataset.id,

console.log(id)  //2

}