@aventure-cloud/vuejs-sweetalert-bridge

0.0.10 • Public • Published

Vuejs Sweetalert Bridge

Vuejs plugin to use sweetalert js lib in a smart way.

Install

npm install @aventure-cloud/vuejs-sweetalert-bridge --save

Import in your project

import AlertsPlugin from '@aventure-cloud/vuejs-sweetalert-bridge';
Vue.use(AlertsPlugin);

Use

Inside your vuejs components:

    methods: {
        save(){
            this.$alerts.confirm(() => {
                console.log('Action confirmed');
            });
        }
    }

Raw swal object

If you need to use a raw swal instance:

this.$alerts.swal();

Use as notification

Main alerts types success, info, error can be used as notification:

this.$alerts.notify('info', {title: 'More info!'});

Notification is success by default:

this.$alerts.notify();

Promise

All plugin element return swal promise to control post execution:

// Alerts
this.$alerts.success().then(() => {
    console.log('Post alert execution');
});

// Notification
this.$alerts.notify().then(() => {
    console.log('Post notification execution');
});

Input form

this.$alerts.confirm((v) => {
    console.log(v);
}, {
    input: 'textarea',
    inputPlaceholder: 'Type your message here'
});

Readme

Keywords

none

Package Sidebar

Install

npm i @aventure-cloud/vuejs-sweetalert-bridge

Weekly Downloads

2

Version

0.0.10

License

MIT

Unpacked Size

12 kB

Total Files

11

Last publish

Collaborators

  • valerione