请问标题是什么??
如果将html
属性设置为true
,则可以使用换行符 --> <br/>
标记。
我怎么做?
swal({ html: true, title: 'hi', text: 'te<br>st' });
似乎对我不起作用
ps 我使用 pr https://github.com/t4t5/sweetalert/pull/772来简化使用,现在一切正常
我应该如何将 html 属性设置为 true? html 属性的顺序是什么,为什么没有记录? 谢谢你。
如果您将html
属性设置为实际的 html 本身(即去掉text
属性并将html
属性设置为 html 内容),它就会起作用,例如
$swal({
title: "My title",
type: "error",
html: "My text with<br />html included"
});
它对我有用,请使用 \n
swal("糟糕", "第 1 行。 \n 第2 行。", "错误");
它只适用于这样的文本的一部分:
swal("Oops", "Line 1.\n line2.", "error");
但如果你想把它作为标题的一部分......它不起作用:
swal("Oops\nOops", "Line 1", "error");
抱歉,但在我看来,在标题中使用多行(并遵循良好的设计规范)是没有意义的。
编辑:感谢@themightystephen
swal({
buttons: ["Wait ", "Add Details"],
html: true,
text: "Text one .\n Text 2.\n Text 3."
})
这是解决方案。 在反应中完美运行。 享受
最有用的评论
如果您将
html
属性设置为实际的 html 本身(即去掉text
属性并将html
属性设置为 html 内容),它就会起作用,例如