a lightweight mobile toast component build on vue
npm install zen-toast --save
import { Toast } from 'zen-toast';
// global use
Vue.use(Toast);
Toast('basic');
Toast.success('success~');
Toast.fail('failed~');
Toast.loading('loading...')
Toast({
message: 'message',
duration: 0.5
});
Toast({
message: 'message!',
duration: 0,
closeOnClick: true
});
name | params | return | Description |
---|---|---|---|
Toast | options | message |
toast instance | show a toast with default style |
Toast.success | options |message |
toast instance | show a toast with success style |
Toast.fail | options | message |
toast instance | show a toast with fail style |
Toast.loading | options | message |
toast instance | show a toast with loading style |
toast.clear | - | void |
instance method,clear current toast |
name | Description | type | default |
---|---|---|---|
message | message text,maxlength 18 | string | ' ' |
duration | Toast duration(s), won't disappear if value is 0 | number | duration is 3s if text length is larger than 8, and 1.5s if it is not |
closeOnClick | Whether to close when click overlay | boolean | false |