Skip to content

树型设计

基础使用

显示树型结构数据,类似目录构造。

可搜索

通过设置showSearch为true,树型数据会显示输入框并自带搜索功能

可展开/收缩

通过设置showExpand为true,树型数据会显示展开按钮和收缩按钮

可多选

通过设置showCheckbox为true,树型数据会显示checkbox,并可以多条选择。

自定义操作列

通过设置customOperation为true,通过onDropOpen和onDropClick搭配使用可以显示自定义操作按钮列

API

属性名称描述类型默认值
treeData树型数据,必须包含key字段,key字段唯一array[{ key: '01', title: '一级标题', children: [], showCreate: true, showUpdate: true, showDelete: true }]
fieldNames自定义节点 title、key、children 的字段object{ title: title, key: key, children: children }
showSearch是否开启搜索功能,默认不开启booleanfalse
showExpand是否开启展开收缩功能,默认不开启booleanfalse
showCheckbox是否开启checkbox, 默认不开启booleanfalse
showOperation是否开启新建、修改、删除功能,默认不开启,与treeData搭配使用,数据项中设置booleanfalse
customOperation自定义设置操作booleanfalse
onCheck点击复选框触发(checkedKeys, node) => {}-
onExpand展开/收起节点时触发(expandedKeys, node) => {}-
onSelect点击树节点触发(selectKeys, node) => {}-
onDropOpendrop触发时调用,自定义时可以返回要展示的操作按钮列表(node) => { return content }-
onDropClick操作列表行点击事件(selected, node) => {}-

Released under the MIT License