<div>
<CheckboxGroup
v-model="checkedItems"
@on-change="checkboxOnChange"
>
<Checkbox
v-for="(item,index) in userList"
:label="item.userId+"|"+item.name"
:true-value="item.checked"
:false-value="!item.checked"
:key="item.userId"
:value="item.userId"
v-model="item.checked"
>
{{item.name}}{{item.userId}}
</Checkbox>
</CheckboxGroup>
</div>
<div
slot="footer"
style=""
>
<Button
type="primary"
@click="checkAll"
></Button>
<Button
type="primary"
@click="noCheck"
></Button>
<Button
type="primary"
@click="confirm"
></Button>
</div>
userList: any = [
{
checked:0,
isMatch:false,
mobile:"13822254125",
name:"bbb",
userId:"13822254125"},
{
checked:0,
isMatch:false,
mobile:"15955562323",
name:"aaa",
userId:"15955562323"}
];
checkAll() {
for (let i = 0; i < this.userList.length; iPP) {
this.userList[i].checked = 1;
}
this.checkedItems = this.userList;
this.menuIds=[];
this.menuNames=[];
console.log("this.checkedItems:",this.checkedItems)
for(let j=0;j<this.checkedItems.length;jPP){
this.menuIds.push(this.checkedItems[j].userId)
this.menuNames.push(this.checkedItems[j].name)
}
}
noCheck() {
console.log("noCheck")
for (let i = 0; i < this.userList.length; iPP) {
this.userList[i].checked = 0;
}
console.log("this.userList:",this.userList)
this.checkedItems = [];
this.menuIds=[];
this.menuNames=[];
}