微信小程序,点击tap 赋值报这个错误。
tapType: function (e){
var that = this;
console.log(e)
const currType = e.currentTarget.dataset.typeId;
that.setData({
currType:currType
});
},
然后打印console.log(e) 》{type: "tap", timeStamp: 1387, target: {…}, currentTarget: {…}, detail: {…}, …}
展开发现有,target,currentTarget,我们获取当前数据。currentTarget:{id: "", offsetLeft: 0, offsetTop: 50, dataset: {…}}
所以点击currentTarget 展开dataset:{type_id: "2"}
所以应该是e.currentTarget.dataset.type_id