1.0.3 • Published 7 years ago

vue2-toastr v1.0.3

Weekly downloads
21
License
-
Repository
-
Last release
7 years ago

vue2-toastr

vue2-toastr is a non-blocking notifications for Vue2 ,Based on toastr stylings and design together with animate.css animation effects

Demo: https://chengxulvtu.github.io/toastr/index.html

Setup

Using npm

npm install vue2-toastr --save

Or using yarn

yarn add vue2-toastr

Usage

Import Component

import CxltToastr from 'vue2-toastr'

Vue.use(CxltToastr)

Optional Global configuration options

var toastrConfigs = {
    position: 'top right',
    showDuration: 2000
}
Vue.use(CxltToastr, toastrConfigs)

You can use All options mentioned in below options table except color option, instead, you should use below additional four color options in global configuration.

OptionTypeDescription
successColorStringbackground color for success notificatoin
infoColorStringbackground color for info notificatoin
warningColorStringbackground color for warning notificatoin
errorColorStringbackground color for error notificatoin

Please note: if you pass color option in your notification instance, it will override above global color options.

Import styling files

import 'vue2-toastr/dist/css/vue2-toastr.css'

Or use it in .vue with style tag

<style src="vue2-toastr/dist/css/vue2-toastr.css"></style>

Call Notification Instance

this.$toast.success({
    title:'',
    message:''
})

vue2-toastr support below functions

functions
success
info
warn
error
removeAll

You need to pass an option object which can have below values, used for controlling title, content, position etc.

options

OptionTypeDescription
titleStringTitle for notification
messageStringContent for notification
closeButtonBooleanNeed close button or not, default as false
progressBarBooleandefault as false
closeOnHoverBooleanstill close when hover,default as false
typeStringType for notification,default as success
positionStringPosition for notification,default as top right
showMethodStringAnimation class name for shown,default as fadeIn
hideMethodStringAnimation class name for hide,default as fadeOut
showDurationNumberDuration of show animation,unit as ms,default as 1000
hideDurationNumberDuration of hide animation,unit as ms,default as 1000
delayNumberDelay of animation,unit as ms,default as 0, means no delay
timeOutNumberDuration of notification displaying,Unit as ms,default as 1500
colorStringbackground color of notification
onClickedFunctioncallback when click
onMouseOverFunctioncallback when mouse over
onMouseOutFunctioncallback when mouse out

type

  • success
  • info
  • warning
  • error

position

  • top right
  • bottom right
  • bottom left
  • top left
  • top center
  • bottom center
  • top full width
  • bottom full width

showMethod

  • bounce
  • flash
  • pulse
  • rubberBand
  • shake
  • headShake
  • swing
  • tada
  • wobble
  • jello
  • bounceIn
  • bounceInDown
  • bounceInLeft
  • bounceInRight
  • bounceInUp
  • fadeIn
  • fadeInDown
  • fadeInDownBig
  • fadeInLeft
  • fadeInLeftBig
  • fadeInRight
  • fadeInRightBig
  • fadeInUp
  • fadeInUpBig
  • flipInX
  • flipInY
  • lightSpeedIn
  • lightSpeedOut
  • rotateIn
  • rotateInDownLeft
  • rotateInDownRight
  • rotateInUpLeft
  • rotateInUpRight
  • hinge
  • rollIn
  • zoomIn
  • zoomInDown
  • zoomInLeft
  • zoomInRight
  • zoomInUp
  • slideInDown
  • slideInLeft
  • slideInRight
  • slideInUp

hideMethod

  • bounce
  • flash
  • pulse
  • rubberBand
  • shake
  • headShake
  • swing
  • tada
  • wobble
  • jello
  • bounceOut
  • bounceOutDown
  • bounceOutLeft
  • bounceOutRight
  • bounceOutUp
  • fadeOut
  • fadeOutDown
  • fadeOutDownBig
  • fadeOutLeft
  • fadeOutLeftBig
  • fadeOutRight
  • fadeOutRightBig
  • fadeOutUp
  • fadeOutUpBig
  • flipOutX
  • flipOutY
  • rotateOut
  • rotateOutDownLeft
  • rotateOutDownRight
  • rotateOutUpLeft
  • rotateOutUpRight
  • rollOut
  • zoomOut
  • zoomOutDown
  • zoomOutLeft
  • zoomOutRight
  • zoomOutUp
  • slideOutDown
  • slideOutLeft
  • slideOutRight
  • slideOutUp

Demo

https://chengxulvtu.github.io/toastr/index.html

Run this project

fork the repository,then follow below commands

git clone xxx
cd vue2-toastr
yarn
npm run dev
1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago