A convenient wrapper for sweetalert2.
Clone or download
Latest commit 1a1d471 Nov 20, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode wip toast Jun 15, 2018
__tests__ simple SSR fix for return promise Jul 31, 2018
assets viwe demo Jul 13, 2018
example ts Nov 5, 2018
nuxt fix nuxt Nov 12, 2018
src ts Nov 5, 2018
.babelrc wip tests Jul 13, 2018
.editorconfig wip tests Jul 13, 2018
.gitignore ts Nov 5, 2018
.npmignore ssr Jul 14, 2018
.travis.yml travis rm greean kiper Nov 12, 2018
README.md Add configuration for nuxt.js Nov 5, 2018
ignore-utils.js tests Jul 13, 2018
package-lock.json audit fix Oct 23, 2018
package.json hack Nov 20, 2018

README.md

vue-sweetalert2

Build Status

Vue.js wrapper for SweetAlert2. With support SSR.

VueSweetalert2

Demo

vue-sweetalert2 demo


Get started

npm install -S vue-sweetalert2

// main.js

import Vue from 'vue';
import VueSweetalert2 from 'vue-sweetalert2';

Vue.use(VueSweetalert2);

Now in the global object, you can access all the methods of sweetalert2.

// example-vue-component.vue

<template>
    <button v-on:click="showAlert">Hello world</button>
</template>

<script>
export default {
    data() {
        return {};
    },
    methods: {
        showAlert(){
            // Use sweetalert2
            this.$swal('Hello Vue world!!!');
        }
    }
}
</script>

// Or

Vue.swal('Hello Vue world!!!');

Nuxt.js

Install dependencies:

npm install -S vue-sweetalert2

Add vue-sweetalert2/nuxt to modules section of nuxt.config.js

{
  modules: [
    'vue-sweetalert2/nuxt'
  ]
}

The documentation for sweetalert2, you can find here.