向用户显示信息,通过提示,展现需要关注的信息。
基本使用
展现需要关注的信息,适用于简短的通知提示。
html
<iui-noticebar> Note that this is a reminder message. </iui-noticebar>
<iui-noticebar> Note that this is a reminder message. </iui-noticebar>
使用图标
通过 icon
属性可以自定义图标,支持所有内置图标。
html
<iui-noticebar icon="sound">
Note that this is a reminder message.
</iui-noticebar>
<iui-noticebar icon="sound">
Note that this is a reminder message.
</iui-noticebar>
可关闭的通知
通过 closeable
属性设置 NoticeBar 是否可关闭。
html
<iui-noticebar closeable> Note that this is a reminder message. </iui-noticebar>
<iui-noticebar closeable> Note that this is a reminder message. </iui-noticebar>
多行展示
通过 wrapable
属性设置 NoticeBar 是否开启多行展示,开启后会在一行展示不下时自动切换为多行展示。
html
<iui-noticebar wrapable>
Note that this is a reminder message. The message is long, but I can choose to
have it scroll or wrap, as it does now.
</iui-noticebar>
<iui-noticebar wrapable>
Note that this is a reminder message. The message is long, but I can choose to
have it scroll or wrap, as it does now.
</iui-noticebar>
滚动播放
通过 animation
属性设置 NoticeBar 是否开启滚动播放,开启后文字会在一行展示不下时滚动播放。
html
<iui-noticebar icon="sound" animation>
Note that this is a reminder message. The message is long, but I can choose to
have it scroll or wrap, as it does now.
</iui-noticebar>
<iui-noticebar icon="sound" animation>
Note that this is a reminder message. The message is long, but I can choose to
have it scroll or wrap, as it does now.
</iui-noticebar>
自定义前后缀内容
通过 suffix
插槽属性可以自定义右侧内容。
html
<iui-noticebar color="success">
<template #prefix>
<iui-icon name="check-circle" size="18" />
</template>
File is uploaded successfully!
</iui-noticebar>
<iui-noticebar>
<template #suffix>
<iui-icon name="right" size="18" />
</template>
Note that this is a reminder message. The message is long, but I can choose to
have it scroll or wrap, as it does now.
</iui-noticebar>
<iui-noticebar color="success">
<template #prefix>
<iui-icon name="check-circle" size="18" />
</template>
File is uploaded successfully!
</iui-noticebar>
<iui-noticebar>
<template #suffix>
<iui-icon name="right" size="18" />
</template>
Note that this is a reminder message. The message is long, but I can choose to
have it scroll or wrap, as it does now.
</iui-noticebar>
API
<Noticebar>
props参数 | 描述 | 类型 | 默认值 |
---|---|---|---|
visible (v-model) | 是否显示 | Boolean | true |
icon | 左侧图标 | String | - |
closeable | 是否可关闭 | Boolean | false |
wrapable | 是否换行 | Boolean | false |
color | 颜色 | primary | success | warning | error | Object: { background: String, color: String } | warning |
animation | 是否开启滚动播放 | Boolean | false |
speed | 滚动速度 | Number | 40 |
<Noticebar>
events事件名 | 描述 | 参数 |
---|---|---|
close | 关闭时触发 | - |
<Noticebar>
slots插槽名 | 描述 | 参数 |
---|---|---|
default | 通知内容 | - |
prefix | 自定义左侧内容 | - |
suffix | 自定义右侧内容 | - |