一般是先修改json值再setData 比如: page({ data:{ s1:{a:"",b:"b"} }, changeData:function(e){ var cData=this.data.s1; cData.a="1";//先修改json值 this.setData({ //再set值 s1:cData }) } })
var id = e.currentTarget.id, data = {};
for (var i = 0, len = type.length; i < len; ++i) {
data[type[i] + 'Show'] = false;
}
data[id + 'Show'] = !this.data[id + 'Show'];
this.setData(data);