小程序 数组 判断 某值 在不在 某数组里面 返回 true 或者 false
inArray: function (search, array) { for (var i in array) { if (array[i] == search) { return true; } } return false; } ========================== for (var index in shoppingCartDataList) { if (that.inArray(shoppingCartDataList[index].goods.id, value)) { shoppingCartDataList[index].checked = true; } else { shoppingCartDataList[index].checked = false; } } this.setData({ selected_goods_ids: value, shoppingCartDataList: shoppingCartDataList })
站长微信:xiaomao0055
站长QQ:14496453