【vue】vue跑马灯vue-marquee-text-component

vue2

复制代码
npm install vue-marquee-text-component@1.2.0

vue3

npm install vue-marquee-text-component

安装完成之后,vue页面全局引入

复制代码
import Vue from 'vue'
import MarqueeText from 'vue-marquee-text-component'

Vue.component('marquee-text', MarqueeText)

页面引入

复制代码
import MarqueeText from 'vue-marquee-text-component'

export default {
  name: 'HelloWorld',
  components: {
    MarqueeText
  }
}

例子:

复制代码
<!-- simple marquee text -->
<marquee-text>
  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna.
</marquee-text>

<!-- short text need more duplicates -->
<marquee-text :repeat="10">
  Short text =(
</marquee-text>

<!-- slow duration -->
<marquee-text :duration="30">
  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna.
</marquee-text>

props

Prop Type Default Description
duration Number 15 Animation Duration
repeat Number 2 Number of repeat the Slot (It's important for to short content)
paused Boolean false The property specifies whether the animation is running or paused
reverse Boolean false Set animation-direction to reverse
复制代码
<!-- parse a unique key for reload the component  -->
<marquee-text :key="currentTrack.id">
  {{ currentTrack.title }}
</marquee-text>
相关推荐
aixingpan4 分钟前
aixingpan.cn API开发文档:api_docs_trichart_natal_marx_transit2接口指南
前端·php
csj505 分钟前
前端基础之《React(13)—表单绑定、列表渲染》
前端·react.js
csj506 分钟前
前端基础之《React(12)—条件渲染》
前端·react.js
IT_陈寒18 分钟前
Java序列化坑了我三天,原来问题出在这个默认方法
前端·人工智能·后端
雪芽蓝域zzs26 分钟前
第四十八节:驾驶舱大屏进阶:数字滚动动画 + 渐变边框美化
前端·javascript·vue.js
ly768931 分钟前
Spring Boot 3.2 虚拟线程在 Web 层与 JDBC 池的实践边界
前端·spring boot·后端·tomcat·jdbc·虚拟线程
Bingo_BIG34 分钟前
LOV列表的查询
前端·javascript·lov
小静AI工程实验室1 小时前
JS 逆向接口 ID 变了?Python 与 Node.js 复现 JSON 大整数精度丢失
javascript·python·node.js
QQ_21696290961 小时前
基于SpringBoot+Vue的小生活平台的设计与实现
java·数据库·vue.js·spring boot·spring·微信小程序·生活
Setsuna_F_Seiei8 小时前
前端转型 Agent 开发 04 之 MCP 与 Skill(赋予 Agent 更广工作能力)
前端·agent