Purpose
This is the Vue@2.x plugin wrapped functions of Alertifyjs which is maintained by MohammadYounes AlertifyJS provides beautiful popup alert / confirm / prompt / messaging views, so you can simply call the function and no need to handle views anymore.
Every method is just a wrapper and return alertify.js function.
So you can use chain method like alertify.prompt('Input (text):').set('type', 'text'); .
Please check promptWithTypeColor
methods.
Installation
npm install vue-alertify
vue-alertify would import the stylesheet of Alertify automatically, so you don't need to import by yourself.
Demo
How to use
;; Vue; var vm = el: '#main' methods: { this$alertify; } { this$alertify; } { this$alertify; } { this$alertify; } { this$alertify; } { this$alertifyprompt 'This is prompt' 'default value' this$alertify this$alertify ; } { this$alertify; } { this$alertify ; } { ; };
Default options
The defaults of alertify can be changed via the options
parameter of the use
statement.
Vue;
Other usage please checkout Alertifyjs documentation
Contributors
Thanks Jonathan Andersson for adding methods with title setting. Thanks simonvomeyser for adding Alertifyjs default override.
Resource
- Alertifyjs: https://github.com/MohammadYounes/AlertifyJS
- How to build commonjs/es/UMD module: http://dev.topheman.com/package-a-module-for-npm-in-commonjs-es2015-umd-with-babel-and-rollup/
- Load Css by js: https://stackoverflow.com/questions/4724606/how-to-use-javascript-to-check-and-load-css-if-not-loaded