How to use the sweetalert2.setDefaults function in sweetalert2

To help you get started, we’ve selected a few sweetalert2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ladjs / lad / template / assets / js / swal.js View on Github external
const swal = require('sweetalert2');

// 
swal.setDefaults(window._swalDefaults || {});

module.exports = swal;
github yanxiaojun617 / webpack4-bootstrap4-demo / src / assets / setting / sweetalert2.js View on Github external
/**
 * 定义swal默认属性
 */
import './sweetalert2.css';
import swal from 'sweetalert2';

if (!!window.ActiveXObject || 'ActiveXObject' in window) {
    /* Include a polyfill for ES6 Promises (optional) for IE11, UC Browser and Android browser support */
    document.write('');
}
swal.setDefaults({
    allowOutsideClick: true,
    confirmButtonText: '确定',
    cancelButtonText: '取消'
});

window.swal = function () {
    let result = swal.apply(this, arguments);
    // swal2-height-auto 这个class会影响页面布局,所以通过js删掉
    $('body').removeClass('swal2-height-auto');
    $('html').removeClass('swal2-height-auto');
    return result;
};
github BrOrlandi / StrangerThingsIntroCreator / scripts / index.js View on Github external
const $ = window.jQuery = require('jquery');
import 'strangerScript';
import ReactDOM from 'react-dom';
import React from 'react';
import makeTheStrangerIntro from 'makeTheStrangerIntro';
import swal from 'sweetalert2';
import bowser from 'bowser';
import downloadVideo from './downloadVideo';
import ajaxErrorFunction from './errorFunction';
import { postUrl, getUrl } from './urls';
import './bitcoinEther';

const browser = bowser.getParser(window.navigator.userAgent);

swal.setDefaults({
    background: '#060606',
    customClass: 'stranger-alert',
});

const defaultOpening = {
    logo: `STRANGER
THINGS`,
    credits0: "A NETFLIX ORIGINAL SERIES",
    credits1: "WINONA RYDER",
    credits2: "DAVID HARBOUR",
    credits3: "FINN WOLFHARD\nMILLIE BOBBY BROWN",
    credits4: "GATEN MATARAZZO\nCALEB McLAUGHLIN",
    credits5: "NATALIA DYER\nCHARLIE HEATON",
    credits6: "CARA BUONO",
    credits7: "And\nMATTHEW MODINE",
    credits8: "Co-Executive Producer\nIAIN PATERSON",