Skip to content

jayzun/vuejs-alert

Repository files navigation

Installation

npm i vuejs-alert --save

Usage

//main.js
import Alert from 'vuejs-alert';
Vue.use(Alert);

//.vue files
/*show component*/
this.$alert.show({text: 'hello world'});
/*close component*/
this.$alert.close();

Preview

vuejs-alert

Option

use option to custom the component.
option is an object.
Use option in the following ways:

  • Set option once.
this.$alert.show(option);
  • Set option globally, the next time you show the component, option would still be effective.
Vue.use(Alert, option);

option available:

key type default description
text string alert text
confirmText string "确定" text of confirm button
cancelText string "取消" text of cancel button
confirmCallback function function to call when confirm button is clicked
cancelCallback function function to call when cancel button is clicked
duration number auto close time, 1000 = 1 second
background string 0.5 opacity of background color, range from 0 to 1

License

The MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published