开发时碰到的一个小问题,在a-form-item中不止需要一个元素的时候,需要用到a-form-item-rest
报错信息:
Warning: [ant-design-vue: Form.Item] FormItem can only collect one field item, you haved setACheckbox
,ACheckboxGroup
2 field items.
You can set not need to be collected fields intoa-form-item-rest
解决办法
<a-form-item class="customerDetail-from-item" label="分配角色" name="fenpeijuese" ref="fenpeijuese">
<a-checkbox
v-model:checked="data.checkAll"
:indeterminate="data.indeterminate"
@change="onCheckAllChange"
>
Check all
</a-checkbox>
<a-divider />
<!-- 用这个组件包含额外的元素就行了 -->
<a-form-item-rest>
<a-checkbox-group v-model:value="data.checkedList" :options="plainOptions" />
</a-form-item-rest>
</a-form-item>