Socket
Socket
Sign inDemoInstall

vue-easy-toast

Package Overview
Dependencies
10
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-easy-toast

A toast plugin for vue/vue2


Version published
Weekly downloads
1.4K
decreased by-44.18%
Maintainers
1
Install size
217 kB
Created
Weekly downloads
 

Readme

Source

Vue-Easy-Toast

Vue 1.x Vue 2.x

A toast plugin for vue/vue2.

DEMO

Note: Since 1.x.x, only Vue 2 is supported. For Vue 1 users please stick to version 0.x.x

Issue/PR is welcomed, I'll response as soon as possible.

Usage

install

npm install vue-easy-toast --save

Quickstart
// before start
import Toast from 'vue-easy-toast'

// or a lite version without inline css, then you have to style yourself or manually import 'vue-easy-toast.css'
import Toast from 'vue-easy-toast/dist/vue-easy-toast-lite.min.js'
require('vue-easy-toast/dist/vue-easy-toast.css') // optional

Vue.use(Toast)

// in your code
Vue.toast('Can I have everybody`s attention?')

// or
$vm.$toast('Let me give a toast to you all.')

// or with HTML Tags
$vm.$toast('Hi <strong>Jonh</strong>')
More

toast or $toast takes 2 parameter: (message, [options])

Options
ParameterTypeDefaultDescription
idstringeasy-toast-defaultUnique identifier globally. Use this to create multiple toasts with different setups.
parentstringbodySelector of the container (TODO, not ready yet, position is fixed to the window)
classNamestring, arraySelf-defined class names to pass through. There are 3 pre-defined classes: et-info, et-warn,et-alert, to toast with different background color
horizontalPositionstringrightPosition horizontal of toast. There are 3 pre-defined positions: left, right and center
verticalPositionstringtopPosition vertical of toast. There are 2 pre-defined positions: top and bottom
durationnumber5000The duration one toast will last, in milliseconds
modestringoverrideoverride or queue. If override, the last toast will forcibly flush previous
closeablebooleanfalsetrue or false. If true, the toast can be closed manually
transitionstringfadeBuilt-in transitions: fade, slide-[up/down/left/right]. See also Transitions
Styling

Besides minimum styling, vue-easy-toast try not to be opinionated about the appearance. It is a simply a div(class="et-wrapper") wrapped a span(class="et-content"). Apply your css freely with them or with your own classes passed in as className.

example
Vue.toast('Hi, there!', {
  id: 'my-toast',
  parent: '#toast-container',
  className: ['my-toast', 'toast-warning'],
  horizontalPosition: 'right',
  verticalPosition: 'top',
  duration: 3000,
  mode: 'queue',
  transition: 'my-transition'
})
TODO
  • font-awesome? emoji?

License

MIT

Keywords

FAQs

Last updated on 26 Mar 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc