1.0.1 • Published 4 years ago

zen-toast v1.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

npm.io npm.io

Introduction

a lightweight mobile toast component build on vue

Installation

npm install zen-toast --save

Usage

import

import { Toast } from 'zen-toast';
// global use
Vue.use(Toast);

basic

Toast('basic');

Toast.success('success~');

Toast.fail('failed~');

Toast.loading('loading...')

custom duration

Toast({
    message: 'message',
    duration: 0.5
});

close on click overlay

Toast({
    message: 'message!',
    duration: 0,
    closeOnClick: true
});

API

methods

nameparamsreturnDescription
Toastoptions | messagetoast instanceshow a toast with default style
Toast.successoptions |messagetoast instanceshow a toast with success style
Toast.failoptions | messagetoast instanceshow a toast with fail style
Toast.loadingoptions | messagetoast instanceshow a toast with loading style
toast.clear-voidinstance method,clear current toast

options

nameDescriptiontypedefault
messagemessage text,maxlength 18string' '
durationToast duration(s), won't disappear if value is 0numberduration is 3s if text length is larger than 8, and 1.5s if it is not
closeOnClickWhether to close when click overlaybooleanfalse