新手现学现卖 温故一下
图片的宽高(自己根据图片来设置)
.image{
width: px;
height: ;
overflow: hidden;
}
.iamge img{
width: px;
height: px;
}
<div id="app">
<div class="image">
<img v-show="i===activeindex" v-for="(item,i) in list" :src="item">
</div>
</div>```
```javascript
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js"></script>
<script>
new Vue({
el:'#app',
data() {
return {
activeindex:0,
list:[]//在这里放入图片地址链接
}
},
mounted() {
//定时器控制播放速度
setInterval(() => {
//activeindex每次加1
if(++this.activeindex===this.list.length){
this.activeindex=0
}
}, 2000);
},
})
</script>