SweetAlert - Изменить модальный цвет - PullRequest
0 голосов
/ 12 октября 2019

По умолчанию цвет белый. Можно ли изменить модальный цвет фона sweetalert2?

Я пытался изменить его с помощью CSS, как я следую по другому вопросу здесь и здесь , какэто:

.sweet-alert 
{
   background-color: #2f2f2f96;
}

но я ничего не получил,

я использую функцию вопроса о подсластке

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) +
        '
', verifyButtonText:' Lovely! '})}})

Хотел бы я сменить модальный цвет на серый

1 Ответ

2 голосов
/ 12 октября 2019

Вы должны добавить background в функцию 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) +
                  "
", verifyButtonText:" Lovely! "});}});
...