NoticeBar (通知栏)
支持多种主题、尺寸和滚动模式,适用于在应用中展示重要通知或公告信息。
支持平台
安卓 | ios | 鸿蒙 | web | 微信小程序 |
---|---|---|---|---|
√ | √ | √ | √ | √ |
示例代码
html
<template>
<t-page main-class="p-30">
<t-card main-class='tdr tdb mb-30' title="Noticon 通知 消息公告" sub-title="自研滚动实现,纵向消息也支持动画时长滚动速度设置"></t-card>
<t-section main-class='tdr tdb mb-30' title='基础功能+主题展示+图标+速度'></t-section>
<t-notice-bar main-class="mb-30" prefixIcon="volume-up" type="p" :barList="noticeBarList"
suffixIcon="map"></t-notice-bar>
<t-section main-class='tdr tdb mb-30' title='主题展示-浅色'></t-section>
<t-notice-bar main-class="mb-30" prefixIcon="volume-up" type="s" :duration="10000" effect='l'
:barList="noticeBarList" suffixIcon="map"></t-notice-bar>
<t-section main-class='tdr tdb mb-30' title='主题展示-镂空'></t-section>
<t-notice-bar main-class="mb-30" prefixIcon="volume-up" type="w" effect='p' :duration="5000"
:barList="noticeBarList" suffixIcon="map"></t-notice-bar>
<t-notice-bar main-class="mb-30-bw-0" prefixIcon="volume-up" type="i" effect='p' :duration="5000"
:barList="noticeBarList" suffixIcon="map"></t-notice-bar>
<t-section main-class='tdr tdb mb-30' title='主题展示-迷你-超大'></t-section>
<t-notice-bar main-class="mb-30" prefixIcon="volume-up" type="error" :barList="noticeBarList" suffixIcon="map"
size="mini"></t-notice-bar>
<t-notice-bar main-class="mb-30" prefixIcon="volume-up" :duration="10000" type="s" :barList="noticeBarList"
suffixIcon="map" size="l"></t-notice-bar>
<t-section main-class='tdr tdb mb-30' title='步进模式-主题-尺寸'></t-section>
<t-notice-bar main-class="mb-30" prefixIcon="volume-up" :duration="1000" :interval="3000" type="s"
:barList="noticeBarList1" size="mini" suffixIcon="map" :step="true"></t-notice-bar>
<t-notice-bar main-class="mb-30" prefixIcon="volume-up" :duration="1000" type="s" :interval="3000"
:barList="noticeBarList1" effect='p' size="s" suffixIcon="map" :step="true"></t-notice-bar>
<t-notice-bar main-class="mb-30" prefixIcon="volume-up" :vertical="true" :interval="3000" :duration="3000"
type="p" effect='l' :barList="noticeBarList1" suffixIcon="map" :step="true"></t-notice-bar>
</t-page>
</template>
<script>
export default {
data() {
return {
noticeBarList1: [
'T-UI基于UNIAPP-X开发优秀的前端组件库',
'Android端编译为kotlin',
'iOS端编译为swift',
'web平台,编译为JavaScript',
'完全不使用js引擎、webview',
'性能完全达到了原生应用的功能'
],
noticeBarList: [
'TuiPlus基于UNIAPP-X开发优秀的前端组件库',
'在Android端编译为kotlin,在iOS端编译为swift,在web平台,编译为JavaScript',
'在APP端完全不使用js引擎、webview,性能完全达到了原生应用的功能'
]
};
}
}
</script>
<style lang="scss">
</style>
属性
名称 | 类型 | 默认值 | 说明 | 可选值 |
---|---|---|---|---|
size | String | mini | 组件尺寸 | large(大尺寸), medium(中尺寸), small(小尺寸), mini(迷你) |
type | String | "" | 组件类型 | info(信息), primary(正常), error(错误), warning(警告), success(成功) |
disabled | Boolean | false | 组件是否禁用 | false, true |
stop | Boolean | false | 是否阻止事件冒泡(Tui统一写法处理事件冒泡) | false, true |
hover | Boolean | true | 是否有点击效果 | false, true |
path | String | "" | 点击组件后跳转的页面路径,如果为空则响应点击事件,如果不为空则跳转页面不会响应单击事件。 | - |
mainClass | String | "" | 组件根节点的样式 | - |
nativeClass | String | "" | 组件根节点原生样式 | - |
effect | String | "normal" | 组件显示主题 | normal(正常), dark(深色), light(浅色), plain(镂空) |
barList | string[] | [] | 消息列表 | |
type | String | info | 主题 | |
duration | Number | 12000 | 滚动持续时间,单位为毫秒 | |
vertical | Boolean | false | 是否纵向滚动 | |
step | Boolean | false | 是否步进滚动 | |
prefixIcon | String | `` | 前置图标的名称 | |
prefixClass | String | `` | 前置图标的样式 | |
suffixIcon | String | `` | 后置图标的名称 | |
interval | Number | 100 | 滚动间隔,单位为毫秒 | |
suffixClass | String | `` | 后置图标的样式 |