element-ui轮播图el-carousel
<template> <div> <div class="w"> <el-carousel height="460px"> <el-carousel-item v-for="(item, index) in list_img" :key="index"> <h3 class="small"> <img :src="item.url" alt /> </h3> </el-carousel-item> </el-carousel> </div> </div> </template> <script> export default { name: Swiper, data() { return { list_img: [ { url: require(../assets/img/01.jpg) }, { url: require(../assets/img/02.webp) }, { url: require(../assets/img/03.webp) }, { url: require(../assets/img/04.webp) }, { url: require(../assets/img/05.webp) }, ], } }, } </script> <style lang="less" scoped> .w { margin: 0 auto; width: 1226px; } .el-carousel__item h3 { color: #475669; font-size: 14px; opacity: 1; line-height: 300px; margin: 0; text-align: center; } .el-carousel__item:nth-child(2n) { background-color: #99a9bf; } .el-carousel__item:nth-child(2n + 1) { background-color: #d3dce6; } .small img { width: 100%; height: 100%; } .el-carousel__container { width: 1226px; height: 460px; } </style>
上一篇:
IDEA上Java项目控制台中文乱码