+
95
-

回答

wxml

<view bindtap=“touch” data-id="{{id}}" >test</view>
{{id}}这里的id为js里面设置的数据;

需要注意的是,这里的data-后面的值是不区分大小写的。获取值是只能用小写获取,页面传值大小写不作区分
js:

touch:function(e){
var id = e.currentTarget.dataset.id;
console.log(id);
}


网友回复

我知道答案,我要回答