首页 > 其他 > 详细

antd TreeSelect树选择 搜索框

时间:2020-06-15 18:34:34      阅读:656      评论:0      收藏:0      [点我收藏+]

树型选择控件支持搜索框

import { TreeSelect } from ‘antd‘;

<TreeSelect
showSearch//显示搜索框
treeNodeFilterProp=‘title‘//输入项过滤对应的 treeNode 属性, value或者title
style={{ width: ‘100%‘}}
dropdownStyle={{ maxHeight: 400, overflow: ‘auto‘ }}
placeholder="机构名称"
allowClear
treeDefaultExpandAll
onChange={this.onTreeChange}
onFocus={this.getTreeSelect}
>
{this.treeNodeRender()}
</TreeSelect>,

//js
treeNodeRender = () => {

const { treeNode } = this.state;

if(!treeNode || !treeNode.length){
return;
}

return treeNode.map((v, i) => {
return (
<TreeNode

value={v.medicalInstitutionId}
title={v.medicalInstitutionSimpleCode}
key={i}
>
{v.children && this.treeNodeChildRender(v.children)}
</TreeNode>
);
});
}

技术分享图片



antd TreeSelect树选择 搜索框

原文:https://www.cnblogs.com/zxiaoyu/p/13132462.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!