{props.actions.map((action: SearchFormAction, index: number) => (
<Form.Item key={index}>
<Button type={action.type} onClick={() =>
props.onClick(index)}>
{action.name}
</Button>
</Form.Item>
))}
传入
const actions = useMemo<SearchFormAction[]>(
() => [
{
name: '新增',
type: 'primary',
},
{
name: '休息日设置',
type: 'primary',
},
],
[],
);
渲染页面