fix: 修复歌词异常空行

This commit is contained in:
imsyy
2023-03-28 14:14:25 +08:00
parent e2f2e1292b
commit db7aaa424a
3 changed files with 9 additions and 4 deletions

View File

@@ -110,7 +110,8 @@
<span
class="lyric"
:style="{ fontSize: setting.lyricsFontSize + 'vh' }"
>{{ item.lyric }}
>
{{ item.lyric }}
</span>
<span
v-show="
@@ -120,7 +121,8 @@
"
:style="{ fontSize: setting.lyricsFontSize - 0.4 + 'vh' }"
class="lyric-fy"
>{{ item.lyricFy }}</span
>
{{ item.lyricFy }}</span
>
</div>
</div>

View File

@@ -59,6 +59,9 @@
:depth="3"
v-html="
music.getPlaySongLyric[music.getPlaySongLyricIndex].lyric
? music.getPlaySongLyric[music.getPlaySongLyricIndex]
.lyric
: '暂无歌词'
"
/>
</Transition>

View File

@@ -18,8 +18,8 @@ const lyricFormat = (lrc) => {
const seconds = time
.split(":")
.reduce((acc, cur) => acc * 60 + parseFloat(cur), 0);
return { time: seconds, lyric: text };
});
return { time: seconds, lyric: text.trim() };
}).filter((element) => element.lyric.trim() !== "");
// 检查是否为纯音乐,是则返回空数组
if (result.length && /纯音乐,请欣赏/.test(result[0].lyric)) {
console.log("该歌曲为纯音乐");