Merge pull request #1035 from spiritree/feature/searchPath

feat: 全局搜索模块支持搜索接口路径
This commit is contained in:
sean1025 2019-07-15 11:36:52 +08:00 committed by GitHub
commit 2f324aef39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -142,9 +142,9 @@ export default class Srch extends Component {
defaultActiveFirstOption={false}
onSelect={this.onSelect}
onSearch={this.handleSearch}
filterOption={(inputValue, option) =>
option.props.children.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
}
// filterOption={(inputValue, option) =>
// option.props.children.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
// }
>
<Input
prefix={<Icon type="search" className="srch-icon" />}

View File

@ -326,7 +326,10 @@ class interfaceModel extends baseModel {
search(keyword) {
return this.model
.find({
title: new RegExp(keyword, 'ig')
$or: [
{ 'title': new RegExp(keyword, 'ig') },
{ 'path': new RegExp(keyword, 'ig') }
]
})
.limit(10);
}