fix: 首页背景视频跳过前2秒水印

This commit is contained in:
leisileken
2026-06-17 19:40:20 +08:00
parent a199750d96
commit 99deb970a0

View File

@@ -1,11 +1,26 @@
<script setup lang="ts">
import { ref } from 'vue'
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { images } from '@/assets/images'
const router = useRouter()
const bgVideoRef = ref<HTMLVideoElement | null>(null)
onMounted(() => {
if (bgVideoRef.value) {
bgVideoRef.value.currentTime = 2
bgVideoRef.value.addEventListener('timeupdate', () => {
if (bgVideoRef.value && bgVideoRef.value.duration > 0) {
if (bgVideoRef.value.currentTime < 2) {
bgVideoRef.value.currentTime = 2
}
}
})
}
})
const stats = [
{ value: '20+', label: '服务客户' },
{ value: '10+', label: '成功案例' },
@@ -83,6 +98,7 @@ const activeTestimonial = ref(0)
<div class="min-h-screen">
<section class="relative min-h-screen flex items-center overflow-hidden">
<video
ref="bgVideoRef"
src="/videos/tech3.mp4"
class="absolute inset-0 w-full h-full object-cover"
autoplay loop muted playsinline