
获得徽章 0
- 怎么改这种代码
for (var index in categorys) {
var type = categorys[index];
if(type.goods_list==undefined){
return;
}
var dishSize = type.goods_list.length;
if (index == 0) {
sumHeight += (dishSize * 109) * this.data.pixelRatio;
} else {
sumHeight += (33 + dishSize * 109) * this.data.pixelRatio;
}
if (scrollHeight <= sumHeight) {
if (type.pid > 0) {
this.setData({
classifySeleted: type.pid,
childSelected: type.id,
views: 'cate' + type.pid,
this_cate_data_name: type.name
})
} else {
this.setData({
classifySeleted: type.id,
views: 'cate' + type.id,
this_cate_data_name: type.name
})
}
break; //跳出当前循环
}
}展开10点赞