vue plugin

SweetAlert2 as vue plugin

SweetAlert2 is a beautiful and customizable replacement for javascript’s popup boxes.
In this post, we are going to create a vue plugin of SweetAlert2.

For more information check out it’s documentation here .

Installation

So we are done with laravel and front end dependencies. let’s add SweetAlert2 using npm.

Vue Plugin setup

Create a plugins folder inside resources/assets/js folder and create file named sweet-alert-plugin.js

And don’t forget to put below line in resources/assets/js/app.js

And also css of SweetAlert2 in resources/assets/saas/app.scss

That’s it. now we can use SweetAlert as vue plugin in any component like below.

Output

SweetAlert2 output

Video

Leave a Comment