题意:“如何在 2018 年使用 SweetAlert 使文本加粗?”
问题背景:
I saw that you could use the content option, but im not really sure how to go about that right now I have something like:
“我看到你可以使用 `content` 选项,但我现在不太确定该如何做。我有类似的代码:”
swal({title: 'hello', text: 'hello ${<strong>{name}</strong>}', icon: 'success' })
问题解决:
From the GitHub Issues, you should set a content and insert the text within it:
“根据 GitHub 问题,你应该设置一个 `content` 并将文本插入其中:”
var name = "Stack Overflow";
var content = document.createElement('div');
content.innerHTML = 'Hello <strong>'+ name +'</strong>';
swal({
title: 'Hello',
content: content,
icon: "success",
})