el-tree设置单选选中
时间: 2023-10-06 14:09:35 浏览: 103
el-tree-select:基于el-select和el-tree改造的树形选择器(下拉框)组件
要将el-tree设置为单选选中,可以使用check-strictly属性并将其设置为true。这样可以关闭父子节点之间的关联,实现单选功能。同时,还需要将show-checkbox属性设置为false,以隐藏复选框。具体的代码示例如下:
<el-tree ref="tree" highlight-current="true" accordion :data="treeData" :default-expanded-keys="treeExpandData" node-key="id" check-strictly="true" show-checkbox="false" :props="treeDefaultProps" @check="checkGroupNode">
</el-tree>
通过以上的代码设置,el-tree将只能单选选中节点。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [el-tree设置单选,点击完成后收起](https://blog.csdn.net/m0_49016709/article/details/125987855)[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_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [el-tree 实现单选](https://blog.csdn.net/CSDNsunyue/article/details/119679764)[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_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [elment-ui tree单选实现](https://download.csdn.net/download/weixin_38546608/14017560)[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_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文