@@ -182,6 +182,15 @@ const lyricData = reactive<LyricData>({
182182 lyricIndex: - 1 ,
183183});
184184
185+ const hasLyricLines = (data : Pick <LyricData , " lrcData" | " yrcData" >) =>
186+ Boolean (data .lrcData ?.length || data .yrcData ?.length );
187+
188+ const shouldIgnoreLoadingUpdate = (data : LyricData ) => {
189+ if (data .lyricLoading !== true ) return false ;
190+ if (hasLyricLines (data ) || ! hasLyricLines (lyricData )) return false ;
191+ return data .songId === undefined || data .songId === lyricData .songId ;
192+ };
193+
185194// 锚点时间(毫秒)与锚点帧时间,用于插值推进
186195let baseMs = 0 ;
187196let anchorTick = 0 ;
@@ -306,7 +315,7 @@ const renderLyricLines = computed<RenderLine[]>(() => {
306315 return placeholder (" SPlayer Desktop Lyric" );
307316 }
308317 // 加载中
309- if (lyricData .lyricLoading ) return placeholder (" 歌词加载中..." );
318+ if (lyricData .lyricLoading && ! lyrics ?. length ) return placeholder (" 歌词加载中..." );
310319 // 纯音乐
311320 if (! lyrics ?.length ) return placeholder (" 纯音乐,请欣赏" );
312321 // 获取当前歌词索引
@@ -708,6 +717,12 @@ onMounted(() => {
708717 window .electron .ipcRenderer .on (
709718 " desktop-lyric:update-data" ,
710719 (_event , data : LyricData & { sendTimestamp? : number }) => {
720+ if (shouldIgnoreLoadingUpdate (data )) {
721+ if (isInitializing .value ) {
722+ isInitializing .value = false ;
723+ }
724+ return ;
725+ }
711726 Object .assign (lyricData , data );
712727 // 首次接收到歌词数据时,立即结束初始化状态
713728 if (isInitializing .value ) {
0 commit comments