-
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.
* feat(cascader): 新增自定义触发器(#2888) * chore(cascader): 生成变更记录文件(#2888) --------- Co-authored-by: yangxuexue <[email protected]>
- Loading branch information
Showing
5 changed files
with
116 additions
and
16 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,5 @@ | ||
--- | ||
"@hi-ui/cascader": minor | ||
--- | ||
|
||
feat: 新增自定义触发器 |
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,5 @@ | ||
--- | ||
"@hi-ui/hiui": patch | ||
--- | ||
|
||
feat(cascader): 新增自定义触发器 |
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,76 @@ | ||
import React from 'react' | ||
import Cascader from '../src' | ||
import Input from '@hi-ui/input' | ||
|
||
/** | ||
* @title 自定义触发器 | ||
*/ | ||
export const CustomRender = () => { | ||
const [data] = React.useState([ | ||
{ | ||
id: '手机', | ||
title: '手机t', | ||
children: [ | ||
{ | ||
id: '小米', | ||
title: '小米t', | ||
children: [ | ||
{ | ||
id: '小米3', | ||
title: '小米3t', | ||
}, | ||
{ | ||
id: '小米4', | ||
title: '小米4t', | ||
}, | ||
], | ||
}, | ||
{ | ||
id: '红米', | ||
title: '红米t', | ||
children: [ | ||
{ | ||
id: '红米3', | ||
title: '红米3t', | ||
}, | ||
{ | ||
id: '红米4', | ||
title: '红米4t', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
id: '电视', | ||
title: '电视t', | ||
children: [ | ||
{ | ||
id: '小米电视4A', | ||
title: '小米电视4At', | ||
}, | ||
{ | ||
id: '小米电视4C', | ||
title: '小米电视4Ct', | ||
}, | ||
], | ||
}, | ||
]) | ||
|
||
return ( | ||
<> | ||
<h1>CustomRender</h1> | ||
<div className="cascader-custom-render__wrap"> | ||
<Cascader | ||
style={{ width: 240 }} | ||
clearable | ||
placeholder="请选择品类" | ||
data={data} | ||
customRender={(data) => { | ||
return <Input value={!data ? '' : data.title + ''} placeholder="请选择" /> | ||
}} | ||
></Cascader> | ||
</div> | ||
</> | ||
) | ||
} |
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