mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
site: filter should be case insensitive
This commit is contained in:
parent
ddb2a0eedb
commit
4f45fca1af
@ -46,6 +46,10 @@ export default class Header extends React.Component {
|
||||
this.props.history.push({ pathname: value });
|
||||
}
|
||||
|
||||
handleSelectFilter(value, option) {
|
||||
return option.props['data-label'].indexOf(value.toLowerCase()) > -1;
|
||||
}
|
||||
|
||||
render() {
|
||||
const routes = this.props.routes;
|
||||
const activeMenuItem = routes[1].path || 'home';
|
||||
@ -58,7 +62,7 @@ export default class Header extends React.Component {
|
||||
const pathSnippet = meta.fileName.split('/')[1];
|
||||
const url = `/components/${pathSnippet}`;
|
||||
return (
|
||||
<Option value={url} key={url} data-label={`${meta.english} {meta.chinese}`}>
|
||||
<Option value={url} key={url} data-label={`${meta.english.toLowerCase()} ${meta.chinese}`}>
|
||||
<strong>{meta.english}</strong>
|
||||
<span className="ant-component-decs">{meta.chinese}</span>
|
||||
</Option>
|
||||
@ -90,6 +94,7 @@ export default class Header extends React.Component {
|
||||
searchPlaceholder="搜索组件..."
|
||||
optionLabelProp="nothing"
|
||||
optionFilterProp="data-label"
|
||||
filterOption={this.handleSelectFilter.bind(this)}
|
||||
onSelect={this.handleSearch.bind(this)}>
|
||||
{options}
|
||||
</Select>
|
||||
|
Loading…
Reference in New Issue
Block a user