feat: 首页播放视频与tab重复问题处理

This commit is contained in:
2026-07-30 22:08:45 +08:00
parent 0bb34f8aa7
commit 3121b2aa53
2 changed files with 21 additions and 0 deletions

View File

@@ -8,7 +8,23 @@
hover-stay-time="80" hover-stay-time="80"
@tap="handleCardTap(panoramaMainCards[0])" @tap="handleCardTap(panoramaMainCards[0])"
> >
<video
v-if="isMp4Video(panoramaMainCards[0].coverImageUrl)"
class="absolute inset-0 h-full w-full"
:src="panoramaMainCards[0].coverImageUrl"
autoplay
loop
muted
:controls="false"
:show-center-play-btn="false"
:show-play-btn="false"
:show-fullscreen-btn="false"
:show-mute-btn="false"
:enable-progress-gesture="false"
object-fit="cover"
/>
<image <image
v-else
class="absolute inset-0 h-full w-full" class="absolute inset-0 h-full w-full"
:src="panoramaMainCards[0].coverImageUrl" :src="panoramaMainCards[0].coverImageUrl"
mode="aspectFill" mode="aspectFill"
@@ -144,6 +160,10 @@ const activeOtherCard = computed(() => {
return panoramaOtherCards.value[activeSwiperIndex.value] || panoramaOtherCards.value[0]; return panoramaOtherCards.value[activeSwiperIndex.value] || panoramaOtherCards.value[0];
}); });
const isMp4Video = (url) => {
return typeof url === "string" && /\.mp4(?:[?#].*)?$/i.test(url.trim());
};
const handleSwiperChange = (event) => { const handleSwiperChange = (event) => {
activeSwiperIndex.value = Number(event.detail?.current || 0); activeSwiperIndex.value = Number(event.detail?.current || 0);
}; };

View File

@@ -78,6 +78,7 @@ const handleContentScroll = (e) => {
/// 点击主景区 /// 点击主景区
const handleMainPanoramaClick = () => { const handleMainPanoramaClick = () => {
isMainPanoramaGuide.value = true; isMainPanoramaGuide.value = true;
discoveryTabs.value = [];
discoveryCards.value = []; discoveryCards.value = [];
exploreCards.value = []; exploreCards.value = [];
discoveryQuickQuestions.value = []; discoveryQuickQuestions.value = [];