如何在 toastr 中显示多行消息?
how to display multi line message in the toastr ?
如何在toastr中显示多行错误信息??
我已将我的错误消息格式化如下
"Please fix the following: \r\nFirst Name is required\r\nLast Name is required\r\nEmail Address is required\r\n"
但在 toasrt 中它显示在单行中。请帮忙
正如 Dr.Stitch 所说,toastr 使用字符串作为 html 所以我们必须添加新行:
Please fix the following: </br>First Name is required</br>Last Name is required</br>Email Address is required</br>
- 更新:2020 年 12 月 15 日:
对于版本 12+:
toastr.success('Please fix the following: </br>First Name is required</br>Last Name is required</br>Email Address is required</br>', '', { closeButton: true, timeOut: 4000, progressBar: true, allowHtml: true });
这行得通!!!谢谢你的帮助。
allowHtml: true
toastr.success('\'Second Review\' validation has started. </br>All SME\'s and Reviewers will get an email notification', '', { closeButton: true, timeOut: 4000, progressBar: true, allowHtml: true });
首先导入 toastr 服务,然后编写消息并启用 HTML
this.toastr.success('First Name is required<br />Last Name is required<br />Email Address is required<br />', {
enableHtml: true
});
请在
中备注
ng-toaster v12.1.0
它是 enableHtml
而不是 allowHtml
而 <br />
是 HTML。
在旧版本中也可能会发生变化。
如何在toastr中显示多行错误信息??
我已将我的错误消息格式化如下
"Please fix the following: \r\nFirst Name is required\r\nLast Name is required\r\nEmail Address is required\r\n"
但在 toasrt 中它显示在单行中。请帮忙
正如 Dr.Stitch 所说,toastr 使用字符串作为 html 所以我们必须添加新行:
Please fix the following: </br>First Name is required</br>Last Name is required</br>Email Address is required</br>
- 更新:2020 年 12 月 15 日:
对于版本 12+:
toastr.success('Please fix the following: </br>First Name is required</br>Last Name is required</br>Email Address is required</br>', '', { closeButton: true, timeOut: 4000, progressBar: true, allowHtml: true });
这行得通!!!谢谢你的帮助。
allowHtml: true
toastr.success('\'Second Review\' validation has started. </br>All SME\'s and Reviewers will get an email notification', '', { closeButton: true, timeOut: 4000, progressBar: true, allowHtml: true });
首先导入 toastr 服务,然后编写消息并启用 HTML
this.toastr.success('First Name is required<br />Last Name is required<br />Email Address is required<br />', {
enableHtml: true
});
请在
中备注ng-toaster v12.1.0
它是 enableHtml
而不是 allowHtml
而 <br />
是 HTML。
在旧版本中也可能会发生变化。