Vue2 轮播图:使用 Element UI 框架实现
<template>
<div class='carousel'>
<el-carousel :interval='4000' arrow='always' indicator-position='outside'>
<el-carousel-item v-for='(item, index) in items' :key='index'>
<img :src='item.image' alt=''>
</el-carousel-item>
</el-carousel>
</div>
</template>
<script>
export default {
data() {
return {
items: [
{ image: 'https://picsum.photos/800/400?random=1' },
{ image: 'https://picsum.photos/800/400?random=2' },
{ image: 'https://picsum.photos/800/400?random=3' },
{ image: 'https://picsum.photos/800/400?random=4' },
]
}
}
}
</script>
<style scoped>
.carousel {
width: 100%;
height: 400px;
margin: 0 auto;
}
</style>
原文地址: https://www.cveoy.top/t/topic/myq5 著作权归作者所有。请勿转载和采集!