参考文章:
CSDN博主「lt要努力」
原文链接:https://blog.csdn.net/louting249/article/details/104615411
CSDN博主「孟孟~」
原文链接:https://blog.csdn.net/qq_37471721/article/details/98863099
<el-checkbox-group
v-else-if="item.type === 'checkbox'"
v-model="data[item.key]"
>
<el-checkbox
v-for="(item1, index1) in item.option"
:key="index1"
:label="item1[item.optionValue || 'value'] + ''"
>{{
item1[item.optionLabel || "label"]
}}</el-checkbox
>
</el-checkbox-group>
问题1:Cannot read property 'length' of undefined
data[item.key] 必须声明为数组,不能是undefined;
问题2:无法选中
:label="item1[item.optionValue || 'value'] + ''" 是选中后的 键,且需为字符串,
item1[item.optionLabel || "label"] 是显示的值