功能,①通用型,三方组件完成(如,elementPlus) ②自己写
轮播图
本文使用vue3中的UI框架——elementPlus——三方组件中的 <el-carousel> 实现轮播图
// 组件静态模板
<template>
<div class="home-banner">
<el-carousel height="500px">
<el-carousel-item v-for="item in bannerList" :key="item.id">
<img :src="item.imgUrl" alt="">
</el-carousel-item>
</el-carousel>
</div>
</template>
<style scoped lang="scss">
.home-banner {
width: 1240px;
height:500px;
position: absolute;
left: 0;
top: 0;
z-index: 98;
img {
width: 100%;
height: 500px;
}
}
</style>
通过<el-carousel>标签使用轮播图,其中,<el-carousel-item>是其中的每一项(图)