用法,区别html
<button id='123' data-userDate='100' bindtap='tabMessage'>刷新</button>
tabMessage: function(e){ console.log(e.target.id); console.log(e.target.dataset); console.log(e.target.dataset.userdate); },
对于小程序中存在js中data的初始数据,假设以下小程序
data: { count: 1, weeek: 1 }, view1: function(e){ this.setData({ count: 2 }) }
在这个js中,若是执行view1函数,则data数据只有count会改变,而week不会改变,不会受到影响。微信小程序