<checker v-model="equipmentcheck" type="checkbox" default-item-class="item"
selected-item-class="item-selected">
<checker-item v-for="item in equipments" :key="item.id" :value="item.id" @on-item-click="onItemClick()">
{{item.name}}
</checker-item>
</checker>
The js function is
onItemClick () {
console.log(this.equipmentcheck.length);
},
question 1: when the result is printed, the length is 0 when it is checked the first time, and 2 is displayed normally when the second is selected, that is to say, there is no case that the length is 1. How is this going on?
question 2:click event does not seem to determine whether it is currently selected or not? Please tell me how to judge whether it is selected or not. -sharp-sharp-sharp topic description
sources of topics and their own ideas
related codes
/ / Please paste the code text below (do not replace the code with pictures)