Notice 通知

显示全局的通知提醒消息

基本用法

  1. showNotice(options) 显示消息弹框
  2. closeALlNotice 关闭所有消息弹框
  3. closeNotice(id, cb) 关闭单个消息弹框

options


指定位置

默认为top-right可选择bottom-righttop-leftbottom-left

自定义颜色

添加参数titleColor可修改标题颜色,添加messageColor可修改信息颜色

手动关闭

根据showNotice指定关闭一个notice

如果要一次性关闭所有可使用closeAll


显示代码

带有倾向性

带有 icon,常用来显示「成功 success、警告 warning、消息 info、错误 error」类的系统消息

显示代码

监听notice关闭

添加参数onClose类型为Function

点击事件

添加参数onClick类型为Function

Attributes

参数 说明 类型 可选值 默认值
type 消息类型,用于显示图标 string success / info / warning / error ''
title 标题 string - 提示
message 消息正文内容 string - ''
duration 持续时间 number - 3000(ms)
position 位置 string top-right/top-left/bottom-right/bottom-left top-right
titleColor 标题颜色 string - -
messageColor 信息颜色 string - -
toast 是否居中显示 只展示message内容 boolean true/false false

Events

事件名称 说明 回调参数
close 关闭的回调 示例ID
closeAll 关闭所有 -
onClick 点击关闭触发 ''