记element-ui checkbox无法选中

element-ui在某些情况下无法选中,本文记录一些自己遇到的问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<el-form-item label='选项'>
<el-checkbox-group v-model="form.type">
<el-checkbox v-for="(item,index) in types" :key="index" :label="item.name" :value="item.value" name="type">
</el-checkbox>
</el-checkbox-group>
</el-form-item>

<script>
export default{
data(){
return {
types:[{name:'往期',value:'history'},{name:'VIP',value:'vip'},{name:'推荐',value:'recommend'},{name:'顶部',value:'top'}],
}
},
methods:{
async getCourse(){
const {data:{code,msg,book}} = await getCourse(this.id);

//可以
book.type = [];
this.form = book;

//错误
//this.form = book;
//this.form.type = [];
}
}
}


</script>