之前的有个缺点就是,在大屏上显示一卡一卡的
继续是底下的滚动的实现
<div class="bottom-text" :style="{transform: 'translate(' + -right + 'px,0px)'}">
<span class="span-style">{{bottomText}}</span>
</div>
data () {
return {
right:0,
}}
created () {
this.$nextTick(() => {
this.right = document.body.clientWidth
})
setInterval(this.scroll, 0)
},
scroll () {
if (this.right < this.rightSelf) {
this.right = this.right + 0.5
} else {
this.right = -this.rightSelf
this.right = this.right + 0.5
}
}
.bottom-text{
font-size: 1.8rem;
color: #FFC107;
margin-bottom: 1rem;
overflow: hidden;
transition: all 0ms ease-in;
}
.span-style{
display: inline-block;
}