Skip to content

t-notice-bar

NoticeBar 通知栏

组件介绍

通知栏组件,支持多种主题、尺寸和滚动模式,适用于在应用中展示重要通知或公告信息。

平台兼容

HarmonyH5AndroidiOS小程序UTS

基础用法

vue
<template>
  <view class="notice-bar-demo">
    <t-notice-bar :barList="noticeList" prefixIcon="volume-up"></t-notice-bar>
    <t-notice-bar :barList="noticeList" :step="true" :vertical="true"></t-notice-bar>
    <t-notice-bar :barList="noticeList" type="warning" suffixIcon="arrow-right"></t-notice-bar>
  </view>
</template>

<script setup>
const noticeList = ref([
  '这是第一条通知公告',
  '这是第二条通知公告',
  '这是第三条通知公告'
]);
</script>

<style scoped>
.notice-bar-demo {
  padding: 20rpx;
}
</style>

Props

属性名类型默认值说明可选值
sizeString"medium"组件尺寸large, medium, small, mini
typeString""组件类型info, primary, error, warning, success
disabledBooleanfalse组件是否禁用true, false
hoverBooleanfalse是否有点击效果true, false
pathString""点击组件后跳转的页面路径-
effectString"normal"组件显示主题normal, dark, light, plain
barListArray[]消息列表-
intervalNumber100滚动间隔,单位为毫秒-
durationNumber12000滚动持续时间,单位为毫秒-
verticalBooleanfalse是否纵向滚动true, false
stepBooleanfalse是否步进滚动true, false
prefixIconString""前置图标的名称-
prefixClassString""前置图标的样式-
suffixIconString""后置图标的名称-
suffixClassString""后置图标的样式-
speedNumber1公告滚动速度,横向滚动时生效-

Events

事件名说明回调参数
select点击公告时触发当前点击公告的索引
click点击时触发-
transitionend动画结束时触发-
initFinished组件初始化完成触发组件的节点信息
touchstart触摸开始时触发触摸事件对象
touchend触摸结束时触发触摸事件对象
touchmove触摸移动时触发触摸事件对象
touchcancel触摸取消时触发触摸事件对象