The element check box component wants to know what this code means?

emrParts = ["", "", "", ""];
value
 const checkedCount = value.length;
 this.checkAll = checkedCount === this.emrParts.length;
 this.isIndeterminate = checkedCount > 0 && checkedCount < this.emrParts.length;
element:
<template>
  <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange"></el-checkbox>
  <div style="margin: 15px 0;"></div>
  <el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange">
    <el-checkbox v-for="city in cities" :label="city" :key="city">{{city}}</el-checkbox>
  </el-checkbox-group>
</template>
<script>
  const cityOptions = ["", "", "", ""];
  export default {
    data() {
      return {
        checkAll: false,
        checkedCities: ["", ""],
        cities: cityOptions,
        isIndeterminate: true
      };
    },
    methods: {
      handleCheckAllChange(val) {
        this.checkedCities = val ? cityOptions : [];
        this.isIndeterminate = false;
      },
      handleCheckedCitiesChange(value) {
        let checkedCount = value.length;
        this.checkAll = checkedCount === this.cities.length;
        this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
      }
    }
  };
</script>
handleCheckedCitiesChange?
Apr.01,2021

determine whether all cities are selected. If all cities are selected, check the check box. If at least one city is selected or no city is selected, select the checkbox as indeterminate status. If no city is selected, all selected checkbox is unselected


let checkedCount = value.length; / / checkedCount is the number of selected cities
this.checkAll = checkedCount = this.cities.length; / / if the number of selected cities (checkedCount) is the same as the number of all cities (this.cities.length), change the status of checkAll to true, otherwise to false.
this.isIndeterminate = checkedCount > 0 & & checkedCount < this.cities.length; / / if the number of selected cities (checkedCount) is greater than 0 and the number of selected cities (checkedCount) is less than the number of all cities (this.cities.length), change the status of isIndeterminate to true, or change the status of isIndeterminate to false.

When

indeterminate is false,checkAll and false, the status is unchecked. When
indeterminate is true,checkAll and false, the status is semi-selected. When
indeterminate is false,checkAll and true, the status is all selected.

Menu