默认颜色为白色。 是否可以更改 sweetalert2 的模态背景颜色?
我尝试用 CSS 来改变它,正如我在另一个问题 here 上所遵循的那样和 here ,像这样:
.sweet-alert
{
background-color: #2f2f2f96;
}
但我什么也没得到,
我使用sweetalert问题功能
Swal.mixin({
input: 'text',
confirmButtonText: 'Next →',
showCancelButton: true,
progressSteps: ['1', '2', '3']
}).queue([
{
title: 'Question 1',
text: 'Chaining swal2 modals is easy'
},
'Question 2',
'Question 3'
]).then((result) => {
if (result.value) {
Swal.fire({
title: 'All done!',
html:
'Your answers: <pre><code>' +
JSON.stringify(result.value) +
'</code></pre>',
confirmButtonText: 'Lovely!'
})
}
})
我希望我可以将模态颜色更改为灰色
最佳答案
您必须在 Swal 函数中添加背景。它会为你工作。
Swal.mixin({
input: "text",
confirmButtonText: "Next →",
showCancelButton: true,
background: 'gray',
progressSteps: ["1", "2", "3"]
})
.queue([
{
title: "Question 1",
text: "Chaining swal2 modals is easy"
},
"Question 2",
"Question 3"
])
.then(result => {
if (result.value) {
Swal.fire({
title: "All done!",
background: 'gray',
html:
"Your answers: <pre><code>" +
JSON.stringify(result.value) +
"</code></pre>",
confirmButtonText: "Lovely!"
});
}
});
关于javascript - SweetAlert - 更改模式颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58353497/