From 7d06faaf97996ae3227b0813b70338682005ac70 Mon Sep 17 00:00:00 2001 From: Flex <q1406482700@163.com> Date: 星期三, 23 四月 2025 10:06:53 +0800 Subject: [PATCH] 我得视频添加轮询 --- easegen-front/src/views/myCourse/index.vue | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/easegen-front/src/views/myCourse/index.vue b/easegen-front/src/views/myCourse/index.vue index 733bbab..3fe32c4 100644 --- a/easegen-front/src/views/myCourse/index.vue +++ b/easegen-front/src/views/myCourse/index.vue @@ -534,6 +534,9 @@ const currentPlayUrl = ref('') const videoRefs = ref<HTMLVideoElement[]>([]) +//璁℃椂鍣� +const Timer = ref() + // 鑾峰彇瑙嗛鍒楄〃 const getList = async () => { loading.value = true @@ -1167,10 +1170,28 @@ stopPolling() }) +//璁℃椂鍣ㄨ疆璇� +const TimerList = ( () => { + Timer.value = setInterval( ()=>{getList()}, 5000 ) +} ) + +//娓呮璁℃椂鍣� +const ClearTimerList = ( () => { + clearInterval(Timer.value) + Timer.value = null +} ) + // 鍒濆鍖� onMounted(() => { + //鍔犺浇鏁版嵁 getList() + //璋冪敤璁℃椂鍣� + TimerList() }) +//娓呮璁℃椂鍣� +onUnmounted( ()=>{ + ClearTimerList() +} ) // 鎾斁棰勮 const playPreview = (type: 'titles' | 'trailer') => { -- Gitblit v1.9.3