【工作日誌】elementUI學習-Layout佈局-2
阿新 • • 發佈:2019-01-25
const cityOptions = ['上海', '北京', '廣州', '深圳'];
export default {
data() {
return {
checkAll: true,
checkedCities: ['上海', '北京'],
cities: cityOptions,
isIndeterminate: true
};
},
methods: {
handleCheckAllChange(event) {
this.checkedCities = event.target.checked ? cityOptions : [];
this .isIndeterminate = false;
},
handleCheckedCitiesChange(value) {
let checkedCount = value.length;
this.checkAll = checkedCount === this.cities.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
}
}
};