-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support option render * feat: test * feat: test * feat: add option * feat: 优化示例 * feat: 优化类型 * feat: review * feat: review * feat: 添加 level index * feat: 删除 level index * feat: disaled * feat: opeion
- Loading branch information
Showing
6 changed files
with
113 additions
and
1 deletion.
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: option-render | ||
nav: | ||
title: Demo | ||
path: /demo | ||
--- | ||
|
||
<code src="../../examples/option-render.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,74 @@ | ||
import React from 'react'; | ||
import '../assets/index.less'; | ||
import Cascader from '../src'; | ||
|
||
const addressOptions = [ | ||
{ | ||
label: '福建', | ||
title: '福建-fj', | ||
value: 'fj', | ||
children: [ | ||
{ | ||
label: '福州', | ||
value: 'fuzhou', | ||
children: [ | ||
{ | ||
label: '马尾', | ||
value: 'mawei', | ||
}, | ||
], | ||
}, | ||
{ | ||
label: '泉州', | ||
value: 'quanzhou', | ||
}, | ||
], | ||
}, | ||
{ | ||
label: '浙江', | ||
value: 'zj', | ||
title: '浙江-zj', | ||
children: [ | ||
{ | ||
label: '杭州', | ||
value: 'hangzhou', | ||
children: [ | ||
{ | ||
label: '余杭', | ||
value: 'yuhang', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
label: '北京', | ||
value: 'bj', | ||
title: '北京-bj', | ||
children: [ | ||
{ | ||
label: '朝阳区', | ||
value: 'chaoyang', | ||
}, | ||
{ | ||
label: '海淀区', | ||
value: 'haidian', | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
const Demo = () => { | ||
return ( | ||
<div> | ||
<Cascader | ||
options={addressOptions} | ||
optionRender={option => { | ||
return <label title={option.title}>{option.label}</label>; | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
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
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