Coder Social home page Coder Social logo

vue-toast's Introduction

vue-toast

Toasts for Vue 2. (Vue 1)

How does it work? Look it here.

Usage

Install:

npm i vue-toast

Import:

import 'vue-toast/dist/vue-toast.min.css'
import VueToast from 'vue-toast'

new Vue({
  template: "<div> <vue-toast ref='toast'></vue-toast> </div>",
  components: { VueToast },
  mounted() {
    const toast = this.$refs.toast

    toast.showToast('Show me toast')
    toast.showToast('Show me toast again!')
  }
})

Global

<link rel="stylesheet" href="./path/to/vue-toast.min.css" charset="utf-8">
<script src='./path/to/vue-toast.min.js'></script>
// it available in window.vueToasts.default

API

  • showToast(string, {}) - main function that generates toast with some settings of instance toast and shows him.
  • setOptions({}) - function for changing settings of component.
  • closeAll() - function for close all toasts.

Settings

Function setOptions({}) lets to change settings of component.

  • position {String} position of component | default: 'left bottom' | possible '[left, right] [top, bottom]'
  • maxToasts {Number} max toasts number | default: 6

Function showToast(string, {}) lets to change settings of current toast.

  • theme {String} style for toast | default: default | possible: info warning error success
  • timeLife {Number} time of life for current toast
  • closeBtn {Boolean} turn off|on button for close toast and disabled|enabled "timeLife"

Example

Look here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.