-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
1 parent
751451f
commit d40559e
Showing
5 changed files
with
151 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: external search | ||
nav: | ||
title: Demo | ||
path: /demo | ||
--- | ||
|
||
<code src="../../examples/external-search.tsx"></code> |
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,96 @@ | ||
import React, { useState } from 'react'; | ||
import '../assets/index.less'; | ||
import Cascader from '../src'; | ||
|
||
const addressOptions = [ | ||
{ | ||
label: '福建', | ||
value: 'fj', | ||
children: [ | ||
{ | ||
label: '福州', | ||
value: 'fuzhou', | ||
children: [ | ||
{ | ||
label: '马尾-mw', | ||
value: 'mawei', | ||
}, | ||
], | ||
}, | ||
{ | ||
label: '泉州-qz', | ||
value: 'quanzhou', | ||
}, | ||
], | ||
}, | ||
{ | ||
label: '浙江', | ||
value: 'zj', | ||
children: [ | ||
{ | ||
label: '杭州', | ||
value: 'hangzhou', | ||
children: [ | ||
{ | ||
label: '余杭', | ||
value: 'yuhang', | ||
}, | ||
{ | ||
label: '福州', | ||
value: 'fuzhou', | ||
children: [ | ||
{ | ||
label: '马尾', | ||
value: 'mawei', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
label: '北京', | ||
value: 'bj', | ||
children: [ | ||
{ | ||
label: '朝阳区', | ||
value: 'chaoyang', | ||
}, | ||
{ | ||
label: '海淀区', | ||
value: 'haidian', | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
const Demo = () => { | ||
const [searchValue, setSearchValue] = useState(''); | ||
return ( | ||
<> | ||
<Cascader | ||
options={addressOptions} | ||
showSearch={{ displayInInput: false }} | ||
searchValue={searchValue} | ||
style={{ width: 300 }} | ||
dropdownRender={menu => { | ||
return ( | ||
<div> | ||
<input | ||
value={searchValue} | ||
onChange={e => setSearchValue(e.target.value)} | ||
placeholder="External Search" | ||
/> | ||
{menu} | ||
</div> | ||
); | ||
}} | ||
animation="slide-up" | ||
notFoundContent="Empty Content!" | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default Demo; |
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
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