将类别添加到甜蜜警报2

时间:2020-01-10 11:02:22

标签: sweetalert2

这个问题已针对sweetalert 1提出 Adding class to sweet alert

现在我的问题是,如何在sweetalert2中添加自定义类?

className:“ new_class”对我不起作用。

1 个答案:

答案 0 :(得分:2)

对于sweetalert2,可以将自定义类添加到多个目标:

Swal.fire({
  ...
  customClass: {
    container: 'container-class',
    popup: 'popup-class',
    header: 'header-class',
    title: 'title-class',
    closeButton: 'close-button-class',
    icon: 'icon-class',
    image: 'image-class',
    content: 'content-class',
    input: 'input-class',
    actions: 'actions-class',
    confirmButton: 'confirm-button-class',
    cancelButton: 'cancel-button-class',
    footer: 'footer-class'
  }
})

文档:https://sweetalert2.github.io/#custom-class