<a-checkbox-group v-model:value="checkedList" :options="plainOptions" @change="achange" />
const checkedList = ref([]);
const plainOptions = ref([]);
function getqrcodeArr() {
plainOptions.value= props.array.map((item) => {
checkedList.value.push(item.value);
return { ...item};
});
console.log(plainOptions.value);
console.log(checkedList.value,"checkedList");
}
const achange=(e)=>{
console.log("0",e);
plainOptions.value = e
console.log(checkedList.value,"checkedList");
}
checkedList.value.push(item.value);
注意这一行是默认全选的关键 不可以通过checkedList.value=PlainOptions.value来赋值
无效
本文介绍了在使用Vue开发中,如何操作checkbox-group组件的v-model属性(checkedList)和plainOptions数组,并指出全选功能不能直接通过checkedList.value=plainOptions.value进行赋值的注意事项。
2219

被折叠的 条评论
为什么被折叠?



