小程序bindtap参数传递
2018-09-20 本文已影响2457人
程序员不务正业
小程序参数中data-xxx 后面的参数不能用驼峰
正常
wxml
<view class='content' data-gid='{{item.gId}}' bindtap='openChatView'>
js
openChatView: function (event) {
var $this = this;
console.log(event.currentTarget.dataset.gid)
},
异常
wxml
<view class='content' data-gId='{{item.gId}}' bindtap='openChatView'>
js
openChatView: function (event) {
var $this = this;
console.log(event.currentTarget.dataset.gId)
},