Skip to content

Commit

Permalink
feat: Result 组件代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjing20 committed Aug 29, 2024
1 parent 155961b commit 74b9779
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
10 changes: 5 additions & 5 deletions packages/editor/src/packages/Functional/Result/Schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ export default {
key: 'basic',
},
{
type: 'Input',
label: 'title 文字',
type: 'Variable',
label: '标题',
name: ['title'],
props: {
placeholder: '请输入 title 文字',
},
},
{
type: 'Input',
label: 'subTitle 文字',
type: 'Variable',
label: '子标题',
name: ['subTitle'],
props: {
placeholder: '请输入 subTitle 文字',
Expand All @@ -46,7 +46,7 @@ export default {
},
{
type: 'Icons',
label: '自定义 icon',
label: '自定义图标',
name: ['icon'],
props: {
placeholder: '请选择图标',
Expand Down
46 changes: 22 additions & 24 deletions packages/materials/Functional/Result/Result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,28 @@ const MResult = ({ id, type, config }: ComponentType<IConfig>, ref: any) => {

return (
visible && (
<div data-id={id} data-type={type}>
<Result
style={config.style}
{...config.props}
icon={config.props.icon ? React.createElement(iconsList[config.props.icon as string]) : undefined}
extra={
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', gap: 10 }}>
{bulkActionList.map((item: any, index: number) => {
return (
<Button
key={item.eventName}
type={item.type}
danger={item.danger}
icon={item.icon ? React.createElement(iconsList[item.icon]) : null}
onClick={() => handleOperate(item.eventName)}
>
{item.text}
</Button>
);
})}
</div>
}
></Result>
</div>
<Result
style={config.style}
{...config.props}
icon={config.props.icon ? React.createElement(iconsList[config.props.icon as string]) : undefined}
extra={
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', gap: 10 }}>
{bulkActionList.map((item: any, index: number) => {
return (
<Button
key={item.eventName}
type={item.type}
danger={item.danger}
icon={item.icon ? React.createElement(iconsList[item.icon]) : null}
onClick={() => handleOperate(item.eventName)}
>
{item.text}
</Button>
);
})}
</div>
}
></Result>
)
);
};
Expand Down

0 comments on commit 74b9779

Please sign in to comment.