任何人都可以给我建议来打破确认框消息。
我已经尝试过下面的代码。但它显示 br 标签作为字符串。还有其他方法可以解决这个问题吗?
this.confirmationService.confirm({
message: 'CoC updated successfully' + '</br>' + ' Do you want to close or continue working with this?',
icon: 'fa fa-question-circle',
header: 'Confirm Save',
accept: () => {
this.infomessage = [];
this.infomessage.push({ severity: 'success', summary: '', detail: Updated Successfully' }); },
reject: () => {
this.router.navigate(['versions']);
}
});
最佳答案
是的,我通过以下步骤得到了它。
步骤 1
我们需要搬家{{message}}
到里面<pre>
标记在
confirmdialog.metadata.json
文件。就像,
<span class=\"ui-confirmdialog-message\"><pre>{{message}}</pre></span>
步骤 2
我们应该添加 white-space: pre-line
在这个类(class).ui-confirmdialog-message
。就像,
.ui-confirmdialog-message {
white-space: pre-line;
}
步骤 3
<小时/>Then if you add
\n
, then we can break the message. like,message : updated successfully \nDo you want to close or continue working with this
希望这个答案对某人有所帮助
关于javascript - 如何将primeng确认框消息打破到单独的行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44316427/