设置媒体列表的类名

This commit is contained in:
A1300399510
2024-09-27 16:33:48 +08:00
parent a46b797594
commit 3399d6507b
6 changed files with 15 additions and 8 deletions

View File

@@ -42,7 +42,8 @@
<img v-else class="arrow rotate180" alt="可点击的左箭头切换" src="@/assets/img/publicImage/black-arrow.svg" />
</div>
<div ref="slideshowList" class="slideshow-list box no-scrollbar flex1 flexacenter">
<div class="item" :class="({pitch: index == carouselIndex}, `item${index}`)" v-for="(item, index) in allCarouselsData" @click="slideshowItem(index)" :key="index">
<!-- <div class="item" :class="({ pitch: index == carouselIndex }, `item${index}`)" v-for="(item, index) in allCarouselsData" @click="slideshowItem(index)" :key="index"> -->
<div class="item" :class="getClass(index)" v-for="(item, index) in allCarouselsData" @click="slideshowItem(index)" :key="index">
<img class="img" alt="公寓图片缩略图" v-lazy="item['thumbnail'] || item['imageurl']" />
<img class="video-icon" v-if="item['type'] != 'attachment'" src="@/assets/img/publicImage/video-icon.svg" />
</div>
@@ -768,7 +769,7 @@ const handleScroll = () => {
}
}
const indicateTypeState = () => {
const indicateTypeState = () => {
let total = 0 // 累计
for (const key in carouselsconfig.value) {
if (carouselsconfig.value[key]["amount"] > 0) total++
@@ -874,9 +875,16 @@ const handleCollect = () => {
const data = res.data
info.value.iscollect = data.status || 0
ElMessage.success(res.message)
})
}
// 设置媒体列表的类名
const getClass = index => {
return {
pitch: index === carouselIndex.value,
[`item${index}`]: true,
}
}
</script>
<style lang="less" scoped>
@@ -1094,7 +1102,6 @@ const handleCollect = () => {
&.pitch {
&::after {
width: 0;
height: 0;
}
}