vue实现新闻轮播滚动

1,584 阅读1分钟

div 部分

遍历循环

style部分

/新闻轮播滚动/

.marquee_top {

transition:all 0.5s;

}

js部分

data(){

//控制动效是否开启

animate:false,

marqueeList:[],}

methods(){

//轮播文字

showMarquee(){

this.animate =true;

setTimeout (() => {

this.marqueeList.push (

this.marqueeList[0 ]

);

this.marqueeList.shift ();

this.animate =false;

}, 500);

},

}

created(){

//开启轮播文字

setInterval (this.showMarquee, 2000)

},