Skip to content

Commit eadd76e

Browse files
committed
解决eslint报错
1 parent 77317a6 commit eadd76e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/App.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ function App() {
471471
<div className="w-full max-w-xs sm:max-w-sm text-center mb-6 sm:mb-8 px-2">
472472
<div
473473
ref={lyricsContainerRef}
474-
className="rounded-lg p-3 sm:p-4 max-h-60 sm:max-h-478 overflow-y-auto custom-scrollbar"
474+
className="rounded-lg p-3 sm:p-4 max-h-60 sm:max-h-80 overflow-y-auto custom-scrollbar"
475475
style={{
476476
scrollBehavior: 'auto',
477477
scrollbarWidth: 'none',
@@ -482,9 +482,13 @@ function App() {
482482
{/* 顶部空白区域 */}
483483
<div className="h-16 sm:h-24"></div>
484484
<div className="text-gray-400 text-xs sm:text-sm">
485-
{musicInfo.lyrics?.split('\\n').map((line, index) => (
486-
<div key={index}>{line}</div>
487-
))}
485+
{typeof musicInfo.lyrics === 'string' ? (
486+
musicInfo.lyrics.split('\n').map((line: string, index: number) => (
487+
<div key={index} className="mb-1">{line}</div>
488+
))
489+
) : (
490+
<div>暂无歌词</div>
491+
)}
488492
</div>
489493
{/* 滚动播放歌词 */}
490494
{/* {lyricArr.length > 0 ?

0 commit comments

Comments
 (0)