tree 树组件
在 element-ui/tree 基础上增加了一些功能,主要包括:
附加(attached)节点
默认选择关键字
基本用法
添加附件节点
Attributes
参数 | 说明 | 类型 | 可选值 | 默认值 |
data | 展示数据 | array | - | - |
options | 配置选项,具体看下表 | object | - | - |
render-attachedNode | 附加节点内容区的渲染 Function | Function(h, data) | - | - |
defaultSelectedKey | 默认选择的节点 | - | 下面补充 | - |
props
参数 | 说明 | 类型 | 可选值 | 默认值 |
childrenProp | 指定子树为节点对象的某个属性值 | string | — | — |
attachedProp | 指定附加树为节点对象的某个属性值 | string | — | — |
nodeLabelProp | 指定节点标签为节点对象的某个属性值 | string | — | — |
attachedLabelProp | 指定附加节点标签为节点对象的某个属性值 | string | — | — |
keyProp | 关键字,用于 el-tree 的 node-key | string | — | id|ID|Id |
defaultSelectedKey
可选值 | 说明 |
treeChildren | 第一个子节点 |
treeAttached | 第一个附加节点 |
key | 这个值跟 props 的 keyProp 有关,如果树节点和附加节点 key 不同,可以用管道符 | 写多个 |
Events
方法名 | 说明 | 参数 |
node-click | 节点被点击时的回调 | data |
default-selected | 加载后默认节点数据的回调 | data |