zoukankan      html  css  js  c++  java
  • antd tree搜索的是id而不是title?只能搜索英文和数字?

    treeNodeFilterProp字段默认是velue,我value里面是id,所以搜索不到自己想要的中文,只能搜索英文和数字

    treeNodeFilterProp 设置为 “title” 即可,
    但是如果title是react node  而不是单纯的string   则需要使用  filterTreeNode  属性  该属性api中有  可以返回function  进行判断,注意必须有返回值,return true 即为想要的node

         <TreeSelect
                    showSearch
                    style={{  '100%' }}
                    dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
                    placeholder="请选择..."
                    allowClear
                    // treeDefaultExpandAll
                    onChange={this.onChange}
        //getPopupContainer={() => document.getElementById('treeBox')}    //treeNode挂载节点
                    treeNodeFilterProp="title"
        // filterTreeNode={this.filterTreeNode}
                  >
                    {this.renderTreeNodes(departmentTree)}
                  </TreeSelect>
  • 相关阅读:
    Innodb加载数据字典 && flush tables
    MySQL purge log简单吗
    MySQL ddl丢表
    数据库 一致性读&&当前读
    java数组
    customer.java
    java构造函数
    EXCEL 2007施工进度横道图制作步骤及实战练习
    如何利用office绘制施工进度计划横道图?
    计算器
  • 原文地址:https://www.cnblogs.com/xiaoyaoweb/p/14201596.html
Copyright © 2011-2022 走看看