forked from growingio/gio-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 修复 groupName 不显示的问题 (growingio#595)
- Loading branch information
Showing
4 changed files
with
50 additions
and
8 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
30 changes: 30 additions & 0 deletions
30
packages/website/src/components/basic/cascader/demo/custom-group-name.tsx
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,30 @@ | ||
import '@gio-design/components/es/components/cascader/style/index.css'; | ||
import '@gio-design/components/es/components/input/style/index.css'; | ||
|
||
import React from 'react'; | ||
|
||
import { Cascader } from '@gio-design/components'; | ||
|
||
const dataSource = [ | ||
{ label: 'option A-1', value: 'a-1', groupId: 'a', groupName: '节能' }, | ||
{ label: 'option A-2', value: 'a-2', groupId: 'a' }, | ||
{ label: 'option B-1', value: 'b-1', groupId: 'b', groupName: '哈哈' }, | ||
{ label: 'option B-2', value: 'b-2', groupId: 'b' }, | ||
]; | ||
|
||
const Basic = (): JSX.Element => { | ||
const groupNameIcons = { a: '🎃', b: '🎄' }; | ||
|
||
return ( | ||
<Cascader | ||
dataSource={dataSource} | ||
groupName={(d) => ( | ||
<div role="img" aria-label="groupName icon"> | ||
{groupNameIcons[d[0].groupId]} | ||
</div> | ||
)} | ||
/> | ||
); | ||
}; | ||
|
||
export default Basic; |
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