Antd Modal confirm确认框的content内容允许换行么?

lifesimple
  • 816

Antd Modal

import { Modal, Button } from 'antd';
const confirm = Modal.confirm;

function showConfirm() {
  confirm({
    title: 'Want to delete these items?',
    content: 'some descriptions',
    onOk() {
      console.log('OK');
    },
    onCancel() {},
  });
}

ReactDOM.render(
  <Button onClick={showConfirm}>
    confirmation modal dialog
  </Button>
, mountNode);

content内容是否允许多行。
比如

content: "hello \n world";

或者

content: "hello<br/>world"

这样尝试发现不行?

应该怎么做呢?

回复
阅读 15k
1 个回答

文档中已经说明了content的类型是element or string, 因此可以:

content: (<p>Hello <br /> world.</p>)

宣传栏