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("没有找到视频元素。"); + } + } + } })