1.定义不同的颜色数组
2.html数据遍历-自定义element-走马灯高度+定义css变量-yf-border-color
<div
v-for="(item, index) in listData"
:key="`${index}`"
:class="`partCurriculum`"
:style="`color:${colorList[index]};--yf-border-color:${colorList[index]}`"
>
<div class="partCurriculumTitle">{{ item.subjectName }}</div>
<div class="moreLink" style="cursor: pointer;" @click="toDownload">
更多课件
<img src="../../assets/img/more_class_btn.png" />
</div>
<el-carousel
trigger="click"
:autoplay="false"
class="partCurriculumVideo"
:height="
item.courseWaresList[0].length > 6
? '740px'
: item.courseWaresList[0].length <= 3
? '250px'
: '500px'
"
>
<el-carousel-item
v-for="(tItem,tIndex) in item.courseWaresList"
:key="`${tItem}${tIndex}`"
class="video_connent"
>
<div
v-for="(LItem,LIndex) in tItem"
:class="`videoBlock`"
:key="`${LItem}${LIndex}`"
>
<img :src="LItem.coursewareImg" alt="正在加载,请耐心等待" />
</div>
</el-carousel-item>
</el-carousel>
- css添加hover
.videoBlock {
position: relative;
width: 29%;
height: 220px;
box-sizing: border-box;
color: #ccc;
&:hover {
border: 4px solid var(--yf-border-color, #4cb352);
}
img {
width: 100%;
height: 100%;
display: block;
}
}