-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bougie
committed
Sep 26, 2019
1 parent
7634ef6
commit 2226776
Showing
3 changed files
with
109 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react' | ||
import DocViewer from '../../../libs/doc-viewer' | ||
import Select from '../../../components/select' | ||
const prefix = 'select-search' | ||
const code = `import React from 'react' | ||
import Select from '@hi-ui/hiui/es/select'\n | ||
class Demo extends React.Component { | ||
constructor () { | ||
super() | ||
this.state = { | ||
singleList: [ | ||
{ title: '小米1', id: 1 }, | ||
{ title: '小米2', id: 2, disabled: true }, | ||
{ title: '小米3', id: 3, disabled: true }, | ||
{ title: '小米4', id: 4 }, | ||
{ title: '小米5', id: 5 }, | ||
{ title: '小米6', id: 6 }, | ||
{ title: '小米8', id: 8 }, | ||
{ title: '小米9', id: 9 }, | ||
] | ||
} | ||
} | ||
render () { | ||
return ( | ||
<Select | ||
type='single' | ||
data={this.state.singleList} | ||
placeholder='搜索多大于等于某个版本' | ||
style={{ width: 200 }} | ||
onChange={(item) => { | ||
console.log('单选结果', item) | ||
}} | ||
searchable | ||
filterOption={(keyword, item) => { | ||
keyword = parseInt(keyword) | ||
return item.id >= keyword | ||
}} | ||
/> | ||
) | ||
} | ||
}` | ||
|
||
const DemoBan = () => ( | ||
<DocViewer | ||
code={code} | ||
scope={{ Select }} | ||
prefix={prefix} | ||
/> | ||
) | ||
export default DemoBan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters