el-checkbox-group回显数据
时间: 2023-10-19 14:01:38 浏览: 93
el-checkbox-group组件在回显数据时,官方文档中只支持绑定基础数据类型(string / number / boolean)。如果需要绑定数组对象结构的数据并进行回显,需要自行解决这个问题。其中,可以参考以下方法解决:
1. 修改源码:可以根据项目所使用的element-ui版本,找到对应版本的element-ui源码,并按照指定版本clone下来。然后找到checkbox组件的源代码(packages/checkbox/src/),对源码进行修改。目前的源码中仅使用了数组的indexOf方法进行处理,不满足我们的需求。因此,可以尝试修改源码,使其支持绑定数组对象结构的数据进行回显。
#### 引用[.reference_title]
- *1* *3* [el-checkbox-group绑定数据为对象的回显问题](https://blog.csdn.net/wilsonfzh/article/details/123998398)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [vue <el-checkbox-group>多选框回显](https://blog.csdn.net/u014508939/article/details/126507322)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]