import{e as t,g as e,t as d,G as n,o}from"./vendor.21cda21c.js";const r={class:"markdown-body"},a=n('

NoticeBar 通告栏

介绍

用于循环播放展示一组消息通知。

安装

\nimport { createApp } from 'vue';\n// vue\nimport { NoticeBar } from '@nutui/nutui';\n\nconst app = createApp();\napp.use(NoticeBar);\n\n

代码示例

基本用法

    <nut-noticebar\n      text="华为畅享9新品即将上市,活动期间0元预约可参与抽奖,赢HUAWEI WATCH等好礼,更多产品信息请持续关注!"\n    ></nut-noticebar>\n

禁用滚动

文字内容多于一行时,可通过scrollable参数控制是否开启滚动

    <nut-noticebar\n      text="华为畅享9新品即将上市,活动期间0元预约可参与抽奖,赢HUAWEI WATCH等好礼,更多产品信息请持续关注!"\n      :scrollable="false"\n    ></nut-noticebar>\n

通告栏模式–关闭模式

    <nut-noticebar\n      :closeMode="true"\n      @click="hello"\n    >华为畅享9新品即将上市,活动期间0元预约可参与抽奖,赢HUAWEI WATCH等好礼,更多产品信息请持续关注!\n    </nut-noticebar>\n

通告栏模式–链接模式

    <nut-noticebar\n      left-icon="https://img13.360buyimg.com/imagetools/jfs/t1/72082/2/3006/1197/5d130c8dE1c71bcd6/e48a3b60804c9775.png"\n    >\n      <a href="https://www.jd.com">京东商城</a>\n    </nut-noticebar>\n

纵向滚动

<nut-noticebar direction='vertical' :list="horseLamp1" :speed='10' :standTime='1000'  @click='go' :closeMode="true"></nut-noticebar>\n
data() {\n    return {\n        horseLamp1: ['惊喜红包免费领', '爆款准点秒', '买超值优惠', '赢百万京豆'],\n    };\n},\n\nmethods:{\n    go(item){\n        console.log(item)\n    }\n}\n

复杂滚动动画

<nut-noticebar direction='vertical' :list="horseLamp2" :speed='10' :standTime='2000' :complexAm='true'></nut-noticebar>\n
data() {\n    return {\n        horseLamp2: ['惊喜红包免费领', '爆款准点秒', '买超值优惠', '赢百万京豆'],\n    };\n}\n

自定义滚动内容

',22),l={class:"language-html"},c=n('
data() {\n    return {\n        horseLamp3: ['惊喜红包免费领', '爆款准点秒', '买超值优惠', '赢百万京豆'],\n    };\n}\n

纵向自定义右侧图标

<nut-noticebar direction='vertical' :list="horseLamp1" :speed='10' :standTime='1000' >\n  <template v-slot:rightIcon>\n    <nut-icon \n      type="trolley" \n      color="#f0250f"\n    >\n    </nut-icon>\n\n  </template>\n</nut-noticebar>\n
data() {\n    return {\n        horseLamp1: ['惊喜红包免费领', '爆款准点秒', '买超值优惠', '赢百万京豆'],\n    };\n}\n

Prop

字段说明类型默认值
direction滚动的方向,可选 across、verticalStringacross
text提示的信息String
closeMode是否启用关闭模式Booleanfalse
leftIconclose为没有左边icon,其他为自定义的图片链接,没有为默认图片String
color导航栏的文字颜色String
background导航栏的背景颜色String
delay延时多少秒String/Number1
scrollable是否可以滚动Booleantrue
speed滚动速率 (px/s)Number50

Prop(direction=vertical)

参数说明类型默认值
list纵向滚动数据列表Array[]
speed滚动的速度Number50
standTime停留时间(毫秒)Number1000
complexAm稍复杂的动画,耗能会高Booleanfalse
height每一个滚动列的高度(px),注意:在使用 slot 插槽定义滚动单元时,按照实际高度修改此值Number40
closeMode是否启用右侧关闭图标,可以通过slot[name=rightIcon]自定义图标Booleanfalse

Event

字段说明回调参数
click外层点击事件回调event: Event
close关闭通知栏时触发event: Event
',10),s={setup:n=>(n,s)=>(o(),t("div",r,[a,e("pre",null,[e("code",l,"\n
"+d(n.item)+"
\n
\n",1)]),c]))};export{s as default};