vue toast组件_vue2的Toast通知组件

vue toast组件

cxlt-vue2-toastr (cxlt-vue2-toastr)

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

cxlt-vue2-toastr是Vue2的非阻塞通知,基于toastr的样式和设计以及animate.css动画效果。

建立 (Setup)

Using npm

使用npm

npm install cxlt-vue2-toastr --save

Or using yarn

或使用纱

yarn add cxlt-vue2-toastr

用法 (Usage)

导入组件 (Import Component)

import CxltToastr from 'cxlt-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
选项 类型 描述
successColor 成功通知的背景色
infoColor 信息通知的背景色
warningColor 警告通知的背景颜色
errorColor 错误通知的背景色

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

请注意:如果您在通知实例中传递了color选项,它将覆盖全局颜色选项之上。

导入样式文件 (Import styling files)

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

Or use it in .vue with style tag

或者在带有样式标签的.vue中使用它

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

通话通知实例 (Call Notification Instance)

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

cxlt-vue2-toastr support below functions

cxlt-vue2-toastr支持以下功能

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
typeStringType for notification,default as success
positionStringPosition for notification,default as top right
iconStringCustom Icon
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
选项 类型 描述
标题 通知标题
信息 通知内容
closeButton 布尔型 是否需要关闭按钮,默认为false
进度条 布尔型 默认为假
类型 通知类型,默认为成功
位置 通知位置,默认为右上
图标 自定义图标
showMethod 显示的动画类名称,默认为fadeIn
hideMethod hide的动画类名称,默认为fadeOut
showDuration 放映动画的持续时间,单位为ms ,默认为1000
hideDuration 隐藏动画的持续时间,单位为ms ,默认为1000
延迟 动画延迟,单位为ms ,默认为0 ,表示无延迟
超时 通知显示的持续时间,单位为ms ,默认为1500
颜色 通知的背景色

类型 (type)

  • success

    success

  • info

    info

  • warning

    warning

  • error

    error

位置 (position)

  • top right

    top right

  • bottom right

    bottom right

  • bottom left

    bottom left

  • top left

    top left

  • top center

    top center

  • bottom center

    bottom center

  • top full width

    top full width

  • bottom full width

    bottom full width

图标 (icon)

Any valid image url.

任何有效的图片网址。

showMethod (showMethod)

  • bounce

    bounce

  • flash

    flash

  • pulse

    pulse

  • rubberBand

    rubberBand

  • shake

    shake

  • headShake

    headShake

  • swing

    swing

  • tada

    tada

  • wobble

    wobble

  • jello

    jello

  • bounceIn

    bounceIn

  • bounceInDown

    bounceInDown

  • bounceInLeft

    bounceInLeft

  • bounceInRight

    bounceInRight

  • bounceInUp

    bounceInUp

  • fadeIn

    fadeIn

  • fadeInDown

    fadeInDown

  • fadeInDownBig

    fadeInDownBig

  • fadeInLeft

    fadeInLeft

  • fadeInLeftBig

    fadeInLeftBig

  • fadeInRight

    fadeInRight

  • fadeInRightBig

    fadeInRightBig

  • fadeInUp

    fadeInUp

  • fadeInUpBig

    fadeInUpBig

  • flipInX

    flipInX

  • flipInY

    flipInY

  • lightSpeedIn

    lightSpeedIn

  • lightSpeedOut

    lightSpeedOut

  • rotateIn

    rotateIn

  • rotateInDownLeft

    rotateInDownLeft

  • rotateInDownRight

    rotateInDownRight

  • rotateInUpLeft

    rotateInUpLeft

  • rotateInUpRight

    rotateInUpRight

  • hinge

    hinge

  • rollIn

    rollIn

  • zoomIn

    zoomIn

  • zoomInDown

    zoomInDown

  • zoomInLeft

    zoomInLeft

  • zoomInRight

    zoomInRight

  • zoomInUp

    zoomInUp

  • slideInDown

    slideInDown

  • slideInLeft

    slideInLeft

  • slideInRight

    slideInRight

  • slideInUp

    slideInUp

hideMethod (hideMethod)

  • bounce

    bounce

  • flash

    flash

  • pulse

    pulse

  • rubberBand

    rubberBand

  • shake

    shake

  • headShake

    headShake

  • swing

    swing

  • tada

    tada

  • wobble

    wobble

  • jello

    jello

  • bounceOut

    bounceOut

  • bounceOutDown

    bounceOutDown

  • bounceOutLeft

    bounceOutLeft

  • bounceOutRight

    bounceOutRight

  • bounceOutUp

    bounceOutUp

  • fadeOut

    fadeOut

  • fadeOutDown

    fadeOutDown

  • fadeOutDownBig

    fadeOutDownBig

  • fadeOutLeft

    fadeOutLeft

  • fadeOutLeftBig

    fadeOutLeftBig

  • fadeOutRight

    fadeOutRight

  • fadeOutRightBig

    fadeOutRightBig

  • fadeOutUp

    fadeOutUp

  • fadeOutUpBig

    fadeOutUpBig

  • flipOutX

    flipOutX

  • flipOutY

    flipOutY

  • rotateOut

    rotateOut

  • rotateOutDownLeft

    rotateOutDownLeft

  • rotateOutDownRight

    rotateOutDownRight

  • rotateOutUpLeft

    rotateOutUpLeft

  • rotateOutUpRight

    rotateOutUpRight

  • rollOut

    rollOut

  • zoomOut

    zoomOut

  • zoomOutDown

    zoomOutDown

  • zoomOutLeft

    zoomOutLeft

  • zoomOutRight

    zoomOutRight

  • zoomOutUp

    zoomOutUp

  • slideOutDown

    slideOutDown

  • slideOutLeft

    slideOutLeft

  • slideOutRight

    slideOutRight

  • slideOutUp

    slideOutUp

运行这个项目 (Run this project)

fork the repository,then follow below commands

分叉存储库,然后遵循以下命令

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

翻译自: https://vuejsexamples.com/toast-notification-component-for-vue2/

vue toast组件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值