Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Toast widget for Vue 1 & 2

License

NotificationsYou must be signed in to change notification settings

noru/vue-easy-toast

Repository files navigation

Vue 1.xVue 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 startimportToastfrom'vue-easy-toast'// or a lite version without inline css, then you have to style yourself or manually import 'vue-easy-toast.css'importToastfrom'vue-easy-toast/dist/vue-easy-toast-lite.min.js'require('vue-easy-toast/dist/vue-easy-toast.css')// optionalVue.use(Toast)// in your codeVue.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 andcenter
verticalPositionstringtopPosition vertical of toast. There are 2 pre-defined positions:top andbottom
durationnumber5000The duration one toast will last, in milliseconds
modestringoverrideoverride orqueue. Ifoverride, the last toast will forcibly flush previous
closeablebooleanfalsetrue orfalse. Iftrue, the toast can be closed manually
transitionstringfadeBuilt-in transitions:fade,slide-[up/down/left/right]. See alsoTransitions
Styling

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

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

About

A Toast widget for Vue 1 & 2

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors8


[8]ページ先頭

©2009-2025 Movatter.jp