Skip to content

横向滚动

默认横行滚动。

vue
<hi-notice-bar :list="list"></hi-notice-bar>

纵向滚动

通过设置 vertical 设为纵向滚动。

vue
<hi-notice-bar :list="list" vertical></hi-notice-bar>

每秒移动固定距离

hi-notice-bar 滚动速度有两种,一种是设置 speed(每秒移动固定距离),另一种是设置 duration(默认,每个通知滚动的时长相同)

vue
<hi-notice-bar :list="list" :speed="50"></hi-notice-bar>

图标和按钮的显示状态

通过 showIcon 设置左侧通知图标的显示状态,默认显示。
通过 showClose 设置右侧关闭按钮的显示状态。
通过 showArrow 设置右侧箭头按钮的显示状态。

vue
<hi-notice-bar :list="list" showIcon></hi-notice-bar>
<hi-notice-bar :list="list" showClose></hi-notice-bar>
<hi-notice-bar :list="list" showArrow></hi-notice-bar>

滚动间隔

组件默认滚动结束后立即开始下一条数据的滚动,设置滚动间隔后可以在当前滚动结束后间隔一段时间再开始滚动。

vue
<hi-notice-bar :list="list" :interval="1.5"></hi-notice-bar>

步近模式

此模式时,文字滚动到左边或顶部时停止。
此模式时,文本会只显示一行,超出显示省略号。
此模式时,一般需要搭配滚动间隔使用。

vue
<hi-notice-bar :list="list" step></hi-notice-bar>
<hi-notice-bar :list="list" vertical step></hi-notice-bar>

Props

参数说明类型默认值可选值
hoverClass文字、更多、关闭点击时的 hover-classStringhi-hover-
show是否显示Booleantrue-
list滚动数据Array--
keyName数据 item 中滚动文本属性的 keyStringtext-
showIcon是否通知图标Booleantrue-
iconName通知图标名称String__gonggao-
showArrow是否显示箭头按钮Booleanfalse-
showClose是否显示关闭按钮Booleanfalse-
arrowIconName箭头图标名称String__you-
closeIconName关闭图标名称String__shanchu-
vertical是否纵向滚动Booleanfalse-
duration滚动时长Numbernull-
speed每秒移动距离Numbernull-
interval滚动间隔Number0-
step是否开启步近模式Booleanfalse-

Events

事件名说明回调参数
@click点击图标时触发item: 数据对象;index: 数据索引
@arrow点击箭头时触发index: 数据索引
@close点击关闭时触发-