小程序参数中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)
},
作者:程序员不务正业
链接:https://www.jianshu.com/p/6bcbbc985345
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。