使用elementplus的过程中出现问题,界面刷新后轮播图并不会自己开始轮播,需要手动摸她一下才开始自动轮播
<template>
<div>
<el-carousel ref="img" :interval="400" type="card" :autoplay="true">
<el-carousel-item v-for="(item, index) in list" :key="index">
<img :src="item.img" alt="" />
</el-carousel-item>
</el-carousel>
</div>
</template>
<script>
import { checklunbo } from "@/api/api/lunbo";
export default {
data() {
return {
list: [],
};
},
created() {
checklunbo().then((res) => {
console.log(res);
this.list = res.data.data;
});
},
computed: {},
mounted() {},
methods: {},
};
</script>
<style lang="css" scoped>
.el-carousel__item h3 {
color: #475669;
opacity: 0.75;
line-height: 200px;
margin: 0;
text-align: center;
}
.el-carousel__item:nth-child(2n) {
background-color: #99a9bf;
}
.el-carousel__item:nth-child(2n + 1) {
background-color: #d3dce6;
}
img {
width: 100%;
height: 100%;
}
</style>