<template>
<div>
<div class="form-group">
<label ></label>
<input type="text" class="form-control" v-model="k">
</div>
<div class="form-group" v-if="k">
<a href="javascript:;" @click="all" ></a>
<template v-for="(v, index) in selects">
<label v-if="v.name.toLowerCase().indexOf(k.toLowerCase()) != -1">
<input type="checkbox" v-model="v.checked" > {{v.name}}
</label>
</template>
</div>
</div>
</template>
<script>
export default {
data() {
return {
k:null,
models:[],
}
},
props:["data", "select"],
methods:{
all(){
for (var i = 0; i < this.selects.length; iPP) {
this.selects[i].checked = true
}
}
},
mounted() {
this.selects = this.select
}
}
</script>
enter A
in the search box to display several results, and then click Select all. Those checkbox didn"t respond. When I typed another keyword in the search box, checkbox was all checked again. This problem has been bothering me for a long time