ant design TreeSelect支持搜索,切换value和title属性

测试人员测试我form里面一个select的时候,发现只能搜索英文和数字,不能搜中文

 后来找到原因,treeNodeFilterProp字段默认是velue,我value里面是id,当然搜不到中文啦

把treeNodeFilterProp改为”title“即可搜索到中文

    <TreeSelect
                    showSearch
                    style={{ width: '90%',marginRight:'8px' }}
                    value={value}
                    dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
                    placeholder="请选择技能组"
                    defaultValue={defaultValue}
                    allowClear
                    multiple ={this.props.multiple}
                    treeDefaultExpandAll
                    onChange={onChange}
                    disabled={isDisabled}
                    treeNodeFilterProp="title"  
                >
                    {treeNodeList}
                </TreeSelect>

猜你喜欢

转载自www.cnblogs.com/rong88/p/12167117.html