1 computed: { 2 isAll: { 3 get: function () { 4 // 每一项都勾选了,全选选中,否则全选不选中 5 return this.list.every((item) => { 6 return item.selected === true; 7 }); 8 }, 9 set(newVal) { 10 // 选中全选,小项都选中 11 this.list.forEach((item) => { 12 item.selected = newVal; 13 }); 14 }, 15 }, 16 },
标签:computed,newVal,selected,item,全选,选中,属性 From: https://www.cnblogs.com/ZhouxsCode/p/16789196.html