Skip to content

Commit

Permalink
fix(select): option设置content未生效问题
Browse files Browse the repository at this point in the history
  • Loading branch information
carolin913 committed Aug 29, 2022
1 parent 402005a commit f55dc61
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/message/_example/close-function.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export default function () {
const [instance, setInstance] = useState(null);
const isMessageOpen = instance === null;
const buttonTips = isMessageOpen ? '打开' : '关闭';

return (
<Button
onClick={() => {
Expand Down
2 changes: 1 addition & 1 deletion src/select/_example/base.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function SingleSelect() {
{ label: '大数据', value: '2' },
{ label: '区块链', value: '3' },
{ label: '物联网', value: '4', disabled: true },
{ label: '人工智能', value: '5' },
{ label: '人工智能', value: '5', content: <span>人工智能(新)</span> },
]}
></Select>
);
Expand Down
6 changes: 3 additions & 3 deletions src/select/_example/multiple.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const options1 = [
{ label: '大数据', value: '2' },
{ label: '区块链', value: '3' },
{ label: '物联网', value: '4', disabled: true },
{ label: '人工智能', value: '5' },
{ label: '人工智能', value: '5', content: <span>人工智能(新)</span> },
{
label: '计算场景',
value: '6',
Expand All @@ -21,7 +21,7 @@ const options2 = [
{ label: '域名注册', value: '3' },
{ label: '网站备案', value: '4' },
{ label: '对象存储', value: '5' },
{ label: '低代码平台', value: '6' },
{ label: '低代码平台', value: '6', content: <span>低代码平台(新)</span> },
];

const MultipleSelect = () => {
Expand All @@ -33,7 +33,7 @@ const MultipleSelect = () => {
<br></br>
<Select defaultValue={['1', '2', '3', '4', '5', '6']} placeholder="请选择云产品" multiple>
{options2.map((item) => (
<Option value={item.value} label={item.label} key={item.value}></Option>
<Option value={item.value} label={item.label} key={item.value} content={item.content}></Option>
))}
</Select>
</Space>
Expand Down
2 changes: 1 addition & 1 deletion src/select/base/Option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const Option = (props: SelectOptionProps) => {
onClick={(e) => e.stopPropagation()}
/>
<span className={classNames(`${classPrefix}-checkbox__input`)}></span>
<span className={classNames(`${classPrefix}-checkbox__label`)}>{children || label}</span>
<span className={classNames(`${classPrefix}-checkbox__label`)}>{children || content || label}</span>
</label>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/select/base/PopupContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const PopupContent = forwardRef((props: SelectPopupProps, ref: Ref<HTMLDivElemen
// 通过 options API配置的
return (
<ul className={`${classPrefix}-select__list`}>
{(options as OptionsType).map(({ value: optionValue, label, disabled, ...restData }, index) => (
{(options as OptionsType).map(({ value: optionValue, label, disabled, content, ...restData }, index) => (
<Option
key={index}
max={max}
Expand All @@ -127,6 +127,7 @@ const PopupContent = forwardRef((props: SelectPopupProps, ref: Ref<HTMLDivElemen
disabled={disabled}
restData={restData}
keys={keys}
content={content}
/>
))}
</ul>
Expand Down

0 comments on commit f55dc61

Please sign in to comment.