0.0.7 • Published 5 years ago
@lanxuexing/vue2toast v0.0.7
vue2toast
Install
npm i @lanxuexing/vue2toast --save
Settings
Name | Default | Type | Description |
---|---|---|---|
duration | 200 | Number | The duration of the toast |
callback | null | Number | The callback of the toast |
Usage
There are two different ways to manage a Toast.
Calling api
// import plugin
import Vue2Toast from '@lanxuexing/vue2toast';
// register plugin on vue
Vue.use(Vue2Toast)
// add a toast on screen
this.$toast.show("Hello, Toast");
// you can manually hide the toast, or it will automatically disappear after a `duration` ms timeout.
this.$toast.show("Hello, Toast", {
duration: 500
});
// you can add callback functions after toast display is complete
this.$toast.show("Hello, Toast", function() {
// do anything
});
Run example:
cd ./vue2toast
npm install