From cb0226b852a52332d6c96f63dae3b9c812f0db3c Mon Sep 17 00:00:00 2001 From: zhcnyuyang Date: Wed, 21 May 2025 21:15:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=B1=8F=E5=8A=A8=E7=94=BB=E5=BD=BB?= =?UTF-8?q?=E5=BA=95=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/HeaderVideo.vue | 56 +++++++++++++++++++++++++++++++--- start.html | 2 +- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/src/components/HeaderVideo.vue b/src/components/HeaderVideo.vue index d00339f..1a19333 100644 --- a/src/components/HeaderVideo.vue +++ b/src/components/HeaderVideo.vue @@ -4,15 +4,58 @@ import { useBootstrapBreakpoint } from './useBreakpoint.js'; const { breakpoint } = useBootstrapBreakpoint(); export default defineComponent({ -name: "HeaderVideo" + name: "HeaderVideo", + data() { + return { + // timestamp: new Date().getTime() + } + }, + methods:{ + handleVideoEnded:function (event){ + window.location.href = "/Homepage"; + } + }, + mounted() { + if(this.$isMobile.phone) + { + // 重置 GIF 图片的 src 以确保从第一帧开始播放 + const img = document.getElementById('beginwep'); + if (img) { + const src = img.getAttribute('src'); + img.setAttribute('src', ''); + setTimeout(() => { + img.setAttribute('src', src); + }, 10); + } + + setTimeout(function() { + // 在这里写入你的跳转语句 + window.location.href = "/Homepage"; + }, 5100); + } + else + { + const videos = document.querySelectorAll('.startvideo'); + // 检查是否找到了视频元素 (可选,但好习惯) + if (videos.length > 0) { + videos.forEach(video => { + video.addEventListener('ended', this.handleVideoEnded); + console.log('为视频添加了 ended 事件监听器:', video); + }); + } else { + console.warn("没有找到视频元素。"); + } + } + } })