在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
<checkbox-group name="owner_xgfy" bindchange="checkboxChange" class="checkboxWrap">
<label class="checkbox" wx:for="{{demo}}" wx:for-index="idx" wx:key="{{idx}}">
<checkbox value='{{item.name}}' checked='{{item.checked}}' bind="{{onChecked}}">{{item.name}}</checkbox>
</label>
</checkbox-group>
var demo = [
{ name: "水费", checked: false },
{ name: "电费", checked: false },
{ name: "物业费", checked: false },
{ name: "收视费", checked: false },
{ name: "供暖费", checked: false },
{ name: "燃气费", checked: false },
{ name: "卫生费", checked: false },
{ name: "上网费", checked: false },
{ name: "燃气费", checked: false },
{ name: "车位费", checked: false },
{ name: "租赁税费", checked: false }
];
console.log(info.owner_xgfy);
var arr = info.owner_xgfy;
demo = demo.map(item =>{
item.checked = arr.indexOf(item.name)!= -1
return item
})
that.setData({
"demo":demo
})
function onChecked(e){
var idx = e.target.value;
demo[idx].checked = !demo[idx].checked;
this.setData({
"demo":demo
})
};
|
请发表评论