This commit is contained in:
parent
f756f00e69
commit
74ff8affe5
|
|
@ -41,7 +41,7 @@
|
||||||
<div class="case-right-content">
|
<div class="case-right-content">
|
||||||
<h3>{{ item.caseCompany }}</h3>
|
<h3>{{ item.caseCompany }}</h3>
|
||||||
<!-- <div>{{ item.caseIntroduction }} </div> -->
|
<!-- <div>{{ item.caseIntroduction }} </div> -->
|
||||||
<div>
|
<div v-if="item.isTextOverflow">
|
||||||
<el-tooltip effect="dark" placement="top">
|
<el-tooltip effect="dark" placement="top">
|
||||||
<div
|
<div
|
||||||
slot="content"
|
slot="content"
|
||||||
|
|
@ -54,6 +54,14 @@
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="product-info-content"
|
||||||
|
v-else
|
||||||
|
:ref="`caseInfoContent-${index}`"
|
||||||
|
>
|
||||||
|
{{ item.caseIntroduction }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -106,19 +114,19 @@ export default {
|
||||||
transitionDuration: '0.5s', // 过渡动画时长
|
transitionDuration: '0.5s', // 过渡动画时长
|
||||||
timer: null, // 自动轮播计时器
|
timer: null, // 自动轮播计时器
|
||||||
interval: 5000, // 轮播间隔时间(ms)
|
interval: 5000, // 轮播间隔时间(ms)
|
||||||
|
extendedCardList: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// 扩展列表:在开头添加最后一个元素的副本,在末尾添加第一个元素的副本,实现无缝滚动
|
// 扩展列表:在开头添加最后一个元素的副本,在末尾添加第一个元素的副本,实现无缝滚动
|
||||||
extendedCardList() {
|
// extendedCardList() {
|
||||||
if (this.cardList.length <= 1) return this.cardList
|
// if (this.cardList.length <= 1) return this.cardList
|
||||||
|
// return [
|
||||||
return [
|
// this.cardList[this.cardList.length - 1], // 最后一个元素的副本放在开头
|
||||||
this.cardList[this.cardList.length - 1], // 最后一个元素的副本放在开头
|
// ...this.cardList, // 原始列表
|
||||||
...this.cardList, // 原始列表
|
// this.cardList[0], // 第一个元素的副本放在末尾
|
||||||
this.cardList[0], // 第一个元素的副本放在末尾
|
// ]
|
||||||
]
|
// },
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// 只有在有多项数据时才启动自动轮播
|
// 只有在有多项数据时才启动自动轮播
|
||||||
|
|
@ -219,6 +227,34 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
cardList: {
|
||||||
|
handler(newValue) {
|
||||||
|
if (newValue <= 1) {
|
||||||
|
this.extendedCardList = newValue
|
||||||
|
} else {
|
||||||
|
this.extendedCardList = [
|
||||||
|
this.cardList[this.cardList.length - 1], // 最后一个元素的副本放在开头
|
||||||
|
...this.cardList, // 原始列表
|
||||||
|
this.cardList[0], // 第一个元素的副本放在末尾
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.extendedCardList.forEach((item, index) => {
|
||||||
|
item.isTextOverflow =
|
||||||
|
this.$refs[`caseInfoContent-${index}`][0]
|
||||||
|
.clientHeight <
|
||||||
|
this.$refs[`caseInfoContent-${index}`][0]
|
||||||
|
.scrollHeight
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -264,7 +300,7 @@ export default {
|
||||||
// 轮播容器样式 - 确保不会显示溢出内容
|
// 轮播容器样式 - 确保不会显示溢出内容
|
||||||
.carousel-wrapper {
|
.carousel-wrapper {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
// overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
// padding: 0 10px;
|
// padding: 0 10px;
|
||||||
// 添加额外的裁剪区域,确保不会显示相邻项的边缘
|
// 添加额外的裁剪区域,确保不会显示相邻项的边缘
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,8 @@
|
||||||
|
|
||||||
<div class="case-right-content">
|
<div class="case-right-content">
|
||||||
<h3>{{ item.caseCompany }}</h3>
|
<h3>{{ item.caseCompany }}</h3>
|
||||||
<!-- <div>{{ item.caseIntroduction }} </div> -->
|
|
||||||
|
|
||||||
<!-- <TextTip :maxLines="2" :content="item.caseIntroduction" /> -->
|
<div v-if="item.isTextOverflow">
|
||||||
|
|
||||||
<div>
|
|
||||||
<el-tooltip effect="dark" placement="top">
|
<el-tooltip effect="dark" placement="top">
|
||||||
<div slot="content" class="product-info-tooltip">
|
<div slot="content" class="product-info-tooltip">
|
||||||
{{ item.caseIntroduction }}
|
{{ item.caseIntroduction }}
|
||||||
|
|
@ -44,6 +41,13 @@
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
class="product-info-content"
|
||||||
|
:ref="`caseInfoContent-${item.id}`"
|
||||||
|
>
|
||||||
|
{{ item.caseIntroduction }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -89,7 +93,21 @@ export default {
|
||||||
async getProductCenterDetailInScreenFun(id) {
|
async getProductCenterDetailInScreenFun(id) {
|
||||||
const res = await getProductCenterDetailAPI({ id })
|
const res = await getProductCenterDetailAPI({ id })
|
||||||
const { list } = res.data
|
const { list } = res.data
|
||||||
this.cardList = list
|
this.cardList = list.map((item) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
isTextOverflow: false,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.cardList.forEach((item) => {
|
||||||
|
item.isTextOverflow =
|
||||||
|
this.$refs[`caseInfoContent-${item.id}`][0]
|
||||||
|
.clientHeight <
|
||||||
|
this.$refs[`caseInfoContent-${item.id}`][0].scrollHeight
|
||||||
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,15 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="product-container">
|
<div
|
||||||
|
v-if="!isTextOverflow"
|
||||||
|
ref="productInfoContent"
|
||||||
|
class="product-info-content"
|
||||||
|
>
|
||||||
|
{{ productDetail.introduction }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="product-container" v-else>
|
||||||
<el-tooltip effect="dark" placement="top">
|
<el-tooltip effect="dark" placement="top">
|
||||||
<div slot="content" class="product-info-tooltip">
|
<div slot="content" class="product-info-tooltip">
|
||||||
{{ productDetail.introduction }}
|
{{ productDetail.introduction }}
|
||||||
|
|
@ -136,6 +144,8 @@ export default {
|
||||||
this.getProductCenterDetailInScreenFun(this.$route.params?.id)
|
this.getProductCenterDetailInScreenFun(this.$route.params?.id)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted() {},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
// 获取产品中心详情
|
// 获取产品中心详情
|
||||||
async getProductCenterDetailInScreenFun(id) {
|
async getProductCenterDetailInScreenFun(id) {
|
||||||
|
|
@ -162,14 +172,23 @@ export default {
|
||||||
typeName,
|
typeName,
|
||||||
linkImage,
|
linkImage,
|
||||||
isAccess,
|
isAccess,
|
||||||
introduction:
|
introduction,
|
||||||
introduction ||
|
|
||||||
'这是一个测试用的长文本内容,用来验证悬浮提示功能是否正常工作。这段文字应该超过四行,从而触发悬浮显示效果。我们添加了更多的文字内容来确保文本能够溢出容器,这样用户就可以通过鼠标悬停来查看完整的产品介绍内容了。这个功能对于长文本的展示非常有用,能够提供更好的用户体验。',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.productCases = list
|
this.productCases = list.map((item) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
isTextOverflow: false,
|
||||||
|
}
|
||||||
|
})
|
||||||
this.productVideos = videoList
|
this.productVideos = videoList
|
||||||
this.productBrochures = fileList
|
this.productBrochures = fileList
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.isTextOverflow =
|
||||||
|
this.$refs.productInfoContent.clientHeight <
|
||||||
|
this.$refs.productInfoContent.scrollHeight
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
goBack() {
|
goBack() {
|
||||||
|
|
@ -869,7 +888,7 @@ export default {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
box-sizing: border-box;
|
// box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-info-header {
|
.product-info-header {
|
||||||
|
|
@ -919,7 +938,6 @@ export default {
|
||||||
font-family: 'PingFang SC', sans-serif;
|
font-family: 'PingFang SC', sans-serif;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
line-height: 1.8;
|
line-height: 1.8;
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue