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

发布时间:2024年01月13日

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

TypeDefaultDescription
durationNumber15Animation Duration
repeatNumber2Number of repeat the Slot (It's important for to short content)
pausedBooleanfalseThe property specifies whether the animation is running or paused
reverseBooleanfalse

Set animation-direction to reverse

<!-- parse a unique key for reload the component  -->
<marquee-text :key="currentTrack.id">
  {{ currentTrack.title }}
</marquee-text>
文章来源:https://blog.csdn.net/angela_zhaoBei/article/details/135573737
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。