div 部分
遍歷循環(huán)
<Col? v-for="(item, index) inmarqueeList" :class="{marquee_top:animate}">
</Col>
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)
},