1.0.2 • Published 7 years ago

vue-toast-plugin v1.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

Vue-Toast-Plugin

Build Status NPM Version

A simple toast plugin for Vue.js.

Demo

Demo

Features

  • Supports both Vue 1.x and 2.x
  • Simple

Installation

npm i vue-toast-plugin

Usage

Need to use with webpack because css is imported in js for convenient.

index.js

import Vue from 'vue'
import Toast from 'vue-toast-plugin'

Vue.use(Toast)

App.vue

export default {
  methods: {
    success () {
      this.$toast(this.$refs.success, 'Wonderful!', 'success')
    },

    warning () {
      this.$toast(this.$refs.warning, 'Attention!', 'warning', 3000)
    },

    info () {
      this.$toast(this.$refs.info, 'Infomation!', 'info', 1000, 100)
    },

    error () {
      this.$toast(this.$refs.error, 'Opps!', 'error', 2000, 500, 600)
    }
  }
}

Options

OptionDescriptionValueDefault
eltarget element
textcontent of the toast
typetype of the toast'success' 'warning' 'info' 'error'
durationtime before the toast vanishes, in millisecond4000
topthe distance between the top of the body and the toast element, in pxright of the target element
leftthe distance between the left of the body and the toast element, in pxbottom of the target element

License

MIT

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago