为了账号安全,请及时绑定邮箱和手机立即绑定

SweetAlert - 改变模态颜色

SweetAlert - 改变模态颜色

绝地无双 2021-11-18 16:13:21
默认情况下,颜色为白色。是否可以更改sweetalert2的模态背景颜色?我试过用 CSS 改变它,因为我在这里和这里关注另一个问题,就像这样:.sweet-alert {   background-color: #2f2f2f96;}但我一无所获,我使用了sweetalert问题功能Swal.mixin({  input: 'text',  confirmButtonText: 'Next &rarr;',  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!'    })  }})我希望我可以将模态颜色更改为灰色
查看完整描述

1 回答

?
RISEBY

TA贡献1856条经验 获得超5个赞

您必须 在 Swal 函数中添加背景。它会为你工作。


Swal.mixin({

          input: "text",

          confirmButtonText: "Next &rarr;",

          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!"

              });

            }

          });


查看完整回答
反对 回复 2021-11-18
  • 1 回答
  • 0 关注
  • 276 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信