我希望能够在 SweetAlert 的标题和文本中包含一个 SweetAlert 变量。
我有以下代码:
swal({
title: "Log In",
text: "Log In to your account.",
icon: logInImage,
content: "input",
button: {
text: "Log In",
closeModal: false,
},
closeOnClickOutside: false,
closeOnEsc: false
})
.then(unm => {
if (!unm) throw null;
swal({
title: `Welcome, ${unm}!`
text: `Your username is ${unm}.`
buttons: false,
icon: logInImage,
closeOnClickOutside: false,
closeOnEsc: false,
})
});
但它不起作用。我希望最终结果如下所示: