项目中有使用到antd的组件库中的modal对话框,需求中的标题和底部按钮都是需要自定义的,记录在此:
modal中的title属性支持string和ReactNode:
title={[<div style={{color:'red'}}>我是标题</div>...可设置多个]} //同时也可以设置样式了
底部同理:footer属性支持string和ReactNode:底部可以只设置一个按钮用作返回
footer={[<Button key="back" onClick={() => this.setIsVisible(false)}>返 回</Button>]} //可设置样式
例如:
<Modal
title={[<div style={{color:'red'}}>我是标题</div>]}
visible={this.state.modal2Visible}
footer={[<Button key="back" onClick={() => this.setIsVisible(false)}>返 回</Button>]}
>
<p>some contents...</p>
<p>some contents...</p>
<p>some contents...</p>
</Modal>
顺手点个赞呐呐呐呐~~~~(体力-1)