2020-07-28 10:03:53 +08:00
|
|
|
|
---
|
|
|
|
|
title: TreeSelect 树形选择器
|
2020-12-02 15:08:47 +08:00
|
|
|
|
description:
|
2020-07-28 10:03:53 +08:00
|
|
|
|
type: 0
|
|
|
|
|
group: null
|
|
|
|
|
menuName: TreeSelect 树形选择器
|
2020-12-02 15:08:47 +08:00
|
|
|
|
icon:
|
2020-07-28 10:03:53 +08:00
|
|
|
|
order: 60
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## 基本使用
|
|
|
|
|
|
2021-01-07 23:35:03 +08:00
|
|
|
|
```schema: scope="body"
|
2020-07-28 10:03:53 +08:00
|
|
|
|
{
|
|
|
|
|
"type": "form",
|
2021-08-09 18:05:01 +08:00
|
|
|
|
"api": "/api/mock2/form/saveForm",
|
2021-06-07 10:09:55 +08:00
|
|
|
|
"body": [
|
2020-07-28 10:03:53 +08:00
|
|
|
|
{
|
|
|
|
|
"type": "tree-select",
|
|
|
|
|
"name": "tree",
|
|
|
|
|
"label": "Tree",
|
2021-03-15 10:30:39 +08:00
|
|
|
|
"searchable": true,
|
2020-07-28 10:03:53 +08:00
|
|
|
|
"options": [
|
|
|
|
|
{
|
|
|
|
|
"label": "Folder A",
|
|
|
|
|
"value": 1,
|
|
|
|
|
"children": [
|
|
|
|
|
{
|
|
|
|
|
"label": "file A",
|
|
|
|
|
"value": 2
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "file B",
|
|
|
|
|
"value": 3
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "file C",
|
|
|
|
|
"value": 4
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "file D",
|
|
|
|
|
"value": 5
|
2020-12-02 15:08:47 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "Folder E",
|
|
|
|
|
"children": [
|
|
|
|
|
{
|
|
|
|
|
"label": "Folder G",
|
|
|
|
|
"children": [
|
|
|
|
|
{
|
|
|
|
|
"label": "file H",
|
|
|
|
|
"value": 6
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "file I",
|
|
|
|
|
"value": 7
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
2020-07-28 10:03:53 +08:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2021-09-15 23:24:14 +08:00
|
|
|
|
## 仅展示选中节点文本信息
|
|
|
|
|
|
|
|
|
|
设置`hideNodePathLabel: true`,可以隐藏选择框中已选择节点的祖先节点(ancestor)的`labelField`字段值,仅展示当前选中节点的`labelField`字段值。
|
|
|
|
|
|
|
|
|
|
```schema: scope="body"
|
|
|
|
|
{
|
|
|
|
|
"type": "form",
|
|
|
|
|
"api": "/api/mock2/form/saveForm",
|
|
|
|
|
"body": [
|
|
|
|
|
{
|
|
|
|
|
"type": "tree-select",
|
|
|
|
|
"name": "tree1",
|
|
|
|
|
"label": "展示已选择节点的祖先节点的文本信息",
|
|
|
|
|
"value": "1,6,7",
|
|
|
|
|
"multiple": true,
|
|
|
|
|
"options": [
|
|
|
|
|
{
|
|
|
|
|
"label": "Folder A",
|
|
|
|
|
"value": 1,
|
|
|
|
|
"children": [
|
|
|
|
|
{
|
|
|
|
|
"label": "file A",
|
|
|
|
|
"value": 2
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "file B",
|
|
|
|
|
"value": 3
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "file C",
|
|
|
|
|
"value": 4
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "file D",
|
|
|
|
|
"value": 5
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "Folder E",
|
|
|
|
|
"children": [
|
|
|
|
|
{
|
|
|
|
|
"label": "Folder G",
|
|
|
|
|
"children": [
|
|
|
|
|
{
|
|
|
|
|
"label": "file H",
|
|
|
|
|
"value": 6
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "file I",
|
|
|
|
|
"value": 7
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"type": "divider"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"type": "tree-select",
|
|
|
|
|
"name": "tree2",
|
|
|
|
|
"label": "仅展示已选择节点的文本信息",
|
|
|
|
|
"value": "1,6,7",
|
|
|
|
|
"multiple": true,
|
|
|
|
|
"hideNodePathLabel": true,
|
|
|
|
|
"options": [
|
|
|
|
|
{
|
|
|
|
|
"label": "Folder A",
|
|
|
|
|
"value": 1,
|
|
|
|
|
"children": [
|
|
|
|
|
{
|
|
|
|
|
"label": "file A",
|
|
|
|
|
"value": 2
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "file B",
|
|
|
|
|
"value": 3
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "file C",
|
|
|
|
|
"value": 4
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "file D",
|
|
|
|
|
"value": 5
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "Folder E",
|
|
|
|
|
"children": [
|
|
|
|
|
{
|
|
|
|
|
"label": "Folder G",
|
|
|
|
|
"children": [
|
|
|
|
|
{
|
|
|
|
|
"label": "file H",
|
|
|
|
|
"value": 6
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "file I",
|
|
|
|
|
"value": 7
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 属性表
|
|
|
|
|
|
2021-06-18 21:14:44 +08:00
|
|
|
|
更多用法,见 [InputTree](./input-tree)
|
2021-09-15 23:24:14 +08:00
|
|
|
|
|
|
|
|
|
| 属性名 | 类型 | 默认值 | 说明 |
|
|
|
|
|
| ----------------- | --------- | ------- | ------------------------------------------- |
|
|
|
|
|
| hideNodePathLabel | `boolean` | `false` | 是否隐藏选择框中已选择节点的路径 label 信息 |
|