-
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(select): add customRender api (#2765)
- Loading branch information
Showing
5 changed files
with
83 additions
and
22 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/hiui": patch | ||
--- | ||
|
||
feat(select): add customRender api |
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/select": minor | ||
--- | ||
|
||
feat: add customRender api |
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,37 @@ | ||
import React from 'react' | ||
import Input from '@hi-ui/input' | ||
import Select from '../src' | ||
|
||
/** | ||
* @title 自定义触发器 | ||
*/ | ||
export const CustomRender = () => { | ||
const [data] = React.useState([ | ||
{ title: '电视', id: '3', disabled: false }, | ||
{ title: '手机', id: '2' }, | ||
{ title: '笔记本', id: '4', disabled: false }, | ||
{ | ||
title: '生活周边超长文案展示超长文案展示', | ||
id: '5', | ||
}, | ||
{ title: '办公', id: '6' }, | ||
{ title: '生活周边7', id: '7' }, | ||
{ title: '办公8', id: '8' }, | ||
]) | ||
|
||
return ( | ||
<> | ||
<h1>CustomRender</h1> | ||
<div className="select-custom-render__wrap"> | ||
<Select | ||
style={{ width: 240 }} | ||
clearable={false} | ||
data={data} | ||
customRender={(data) => { | ||
return <Input value={!data ? '' : data.title + ''} readOnly placeholder="请选择" /> | ||
}} | ||
/> | ||
</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