Skip to content

TreeFilter 树形筛选器

基础使用

defaultValue 可以在初始化时,默认选择某一个树节点。

监听 change 事件,获取当前选中的节点。

部门列表(单选)

全部
Level one 1
Level two 1-1
Level three 1-1-1
Level three 1-1-2
Level one 2
Level two 2-1
Level two 2-2
Level one 3
Level two 3-1
Level two 3-2

部门列表(多选)

Level one 1
Level two 1-1
Level three 1-1-1
Level three 1-1-2
Level one 2
Level two 2-1
Level two 2-2
Level one 3
Level two 3-1
Level two 3-2

API 获取数据

通过 request-api 配置项,可以让组件内部调用接口获取数据,并自动添加 全部 选项在第一级。

通过 defaultRequestParams 配置项,可以设置接口需要传递的参数。

通过 transformData 配置项,可以在通过接口获取数据进行加工处理,最后返回一个新的数据。

部门列表

暂无数据

Attributes

属性名说明类型默认值
data树形数据array []
requestApi请求数据的 apifunction
defaultRequestParams默认请求参数object {}
transformData对请求成功的数据进行处理function
titletreeFilter 标题string''
id选择的 idstringid
label显示的 labelstringlabel
multiple是否为多选booleanfalse
defaultValue默认选中的值TreeKey / array
enableTotal是否显示 全部 选项booleantrue
defaultFirst是否默认选中第一个选项booleanfalse
card是否使用卡片样式booleantrue
...其他扩展属性,支持所有 ElTree Attributes......

Events

名称说明类型
change选中值变化事件function

Slots

插槽名说明作用域插槽参数
title自定义标题
...其他扩展属性,支持所有 ElTree Slots...

Exposes

名称说明类型
treeData树形数据array
treeAllData包含"全部"的树数据array
initTreeData初始化树形数据function
treeInstanceElTree 实例object