# Notification 通知

用于向用户反馈重要的警告提示和通知消息。

# 代码演示

# 使用方式

  • 全局使用

WinDesign 为 Vue.prototype 添加了全局方法 $Notify。因此在 vue instance 中可以采用本页面中的方式调用 Notification。

  • 单独引用

单独引入 Notification:

import { Notification } from 'win-design'
1

此时调用方法为 Notification(options)。我们也为每个 type 定义了各自的方法,如 Notification.success(options)。并且可以调用 Notification.closeAll() 手动关闭所有实例。

# API

# Attributes

参数 说明 类型 可选值 默认值
title 标题 String
message 说明文字 String | Vue.VNode
dangerously-use-html-string 是否将 message 属性作为 HTML 片段处理 Boolean false
type 主题样式,如果不在可选值内将被忽略 String 'success' | 'warning' | 'info' | 'error'
icon-class 自定义图标的类名。若设置了 type,则 icon-class 会被覆盖 String
custom-class 自定义类名 String
duration 显示持续时间, 单位毫秒。设为 0 则不会自动关闭 Number 5000
position 自定义弹出位置 String 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' 'top-right'
show-close 是否显示关闭按钮 Boolean true
on-close 关闭时的回调函数 Function
on-click 点击 Notification 时的回调函数 Function
offset 偏移的距离,在同一时刻,所有的 Notification 实例应当具有一个相同的偏移量 Number 0
key 当前提示的唯一标志 String / Number

# Events

调用 Notificationthis.$Notify 会返回当前 Notification 的实例。如果需要手动关闭实例,可以调用它的 close 方法。

方法名 说明
close 关闭当前的 Notification
上次更新: 5/9/2024, 9:16:31 AM