我想做一个类似跑马灯的抽奖,目前已经实现了图片轮播部分,代码如下:开始exportdefault{data(){return{imgList:['http://n.sinaimg.cn/news/1_img/dfic/3ad618a7/107/w1024h683/20191023/46f6-ihfpfwa8114476.jpg','http://n.sinaimg.cn/news/1_img/dfic/3ad618a7/107/w1024h683/20191023/f798-ihfpfwa8114474.jpg','http://n.sinaimg.cn/news/1_img/dfic/3ad618a7/107/w1024h683/20191023/2e70-ihfpfwa8114472.jpg','http://n.sinaimg.cn/news/1_img/dfic/3ad618a7/107/w683h1024/20191023/92ee-ihfpfwa8114467.jpg'],timer:null,theSpeed:2,imgWidth:260,theDirection:'left',}},methods:{clickLeft(){//console.log(Math.floor(Math.random()*this.imgList.length))this.toLeft();},toLeft(){letthat=this;letimgBox=this.$refs.imgBox;letimgDiv=this.$refs.imgDiv;imgBox.innerHTML+=imgBox.innerHTML;imgBox.style.width=imgDiv.length*this.imgWidth+'px';//设置ul的宽度使图片可以放下functionautoScroll(){if(imgBox.offsetLeft
添加回答
举报
0/150
提交
取消