diff --git a/src/pages/video/index.tsx b/src/pages/video/index.tsx index d9a8d30..6b29fb6 100644 --- a/src/pages/video/index.tsx +++ b/src/pages/video/index.tsx @@ -74,9 +74,12 @@ export default function VideoIndex() { useEffect(loadList, []) const totalDuration = useMemo(() => { if (!videoData || videoData.length == 0) return 0; + if(state.playingIndex == -1 || state.playingIndex >= videoData.length) return 0 + const v= videoData[state.playingIndex] as VideoInfo; + return Math.ceil(v.duration / 1000) // 计算总时长 - return videoData.reduce((sum, v) => sum + Math.ceil(v.duration / 1000), 0); - }, [videoData]) + //return videoData.reduce((sum, v) => sum + Math.ceil(v.duration / 1000), 0); + }, [videoData,state.playingIndex]) return (