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

查看:990
本文介绍了javascript - Antd Modal confirm确认框的content内容允许换行么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

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"

这样尝试发现不行?

应该怎么做呢?

解决方案

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

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

这篇关于javascript - Antd Modal confirm确认框的content内容允许换行么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆