Antd Modal弹框自定义按钮数量和样式

Antd的Modal组件默认按钮只有确认、取消两个。

footer 底部内容,当不需要默认底部按钮时,可以设为 footer={null} string|ReactNode 确定取消按钮

该属性支持ReactNode

F12拷贝的原有按钮样式。

<Modal
    onCancel={隐藏}
    footer={[	
        <button type="button" class="ant-btn"><span>取 消</span></button>,
        <button type="button" class="ant-btn ant-btn-primary"><span>确 认</span></button>
    ]}
></Modal>

注:当自定义按钮时,Modal上的onCancel属性不可缺失。因为右上角还有个关闭按钮。

posted @ 2022-08-22 14:50  heshibina  阅读(1125)  评论(0)    收藏  举报