【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>
相关推荐
不像程序员的程序媛1 小时前
Nginx日志切分
服务器·前端·nginx
Daniel李华1 小时前
echarts使用案例
android·javascript·echarts
北原_春希1 小时前
如何在Vue3项目中引入并使用Echarts图表
前端·javascript·echarts
JY-HPS1 小时前
echarts天气折线图
javascript·vue.js·echarts
尽意啊1 小时前
echarts树图动态添加子节点
前端·javascript·echarts
吃面必吃蒜1 小时前
echarts 极坐标柱状图 如何定义柱子颜色
前端·javascript·echarts
O_oStayPositive1 小时前
Vue3使用ECharts
前端·javascript·echarts
竹秋…1 小时前
echarts自定义tooltip中的内容
前端·javascript·echarts
宝贝露.1 小时前
Axure引入Echarts图无法正常显示问题
前端·javascript·echarts
shmily麻瓜小菜鸡1 小时前
前端文字转语音
前端