2020-08-27 17:18:57 +08:00

4.2 KiB
Raw Blame History

pageClass
comp-page-class

Toast 全局提示

概述

轻量级的信息反馈组件,在屏幕中间显示,并自动消失。

代码示例

显示普通的提示

最基本的提示默认在3秒后消失。

显示错误的提示 显示警告的提示 显示成功的提示

不同的提示状态:成功、警告、错误。

10s显示

设置配置对象中的duration可以修改显示时间

在头部提示

设置配置对象中的align为top默认是center

提示关闭回调

设置配置对象中的onClose当toast关闭时执行onClose

API

提供了静态方法在Vue实例里面调用以下方法来使用组件

this.$Toast(message, [option])
this.$Toast.success(message, [option])
this.$Toast.error(message, [option])
this.$Toast.warn(message, [option])

立即销毁提示:

const destroy = this.$Toast(message, [option]);
destroy()

Options

属性 说明 类型 默认值
message 提示内容 String null
option.duration 提示显示时间 Number 3000
option.align 提示的区域,可选值有top,center String center
option.onClose 当提示消失时触发的事件 Function null