mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2024-11-24 02:02:17 +00:00
feat: 即使不存在歌曲元数据,也展示默认的“暂无封面”占位图片
This commit is contained in:
parent
4341203c08
commit
aaefffbb8b
@ -18,6 +18,7 @@ import {
|
|||||||
import { DecryptedAudioFile, deleteFile, ProcessState } from './fileListingSlice';
|
import { DecryptedAudioFile, deleteFile, ProcessState } from './fileListingSlice';
|
||||||
import { useCallback, useRef } from 'react';
|
import { useCallback, useRef } from 'react';
|
||||||
import { useAppDispatch } from '~/hooks';
|
import { useAppDispatch } from '~/hooks';
|
||||||
|
import coverSvgUrl from '~/assets/no-cover.svg';
|
||||||
|
|
||||||
interface FileRowProps {
|
interface FileRowProps {
|
||||||
id: string;
|
id: string;
|
||||||
@ -83,14 +84,12 @@ export function FileRow({ id, file }: FileRowProps) {
|
|||||||
>
|
>
|
||||||
<GridItem area="cover">
|
<GridItem area="cover">
|
||||||
<Center w="160px" h="160px" m="auto">
|
<Center w="160px" h="160px" m="auto">
|
||||||
{metadata && (
|
|
||||||
<Image
|
<Image
|
||||||
objectFit="cover"
|
objectFit="cover"
|
||||||
src={metadata.cover}
|
src={metadata?.cover}
|
||||||
alt={`"${metadata.album}" 的专辑封面`}
|
alt={`${metadata?.album} 的专辑封面`}
|
||||||
fallbackSrc={'/assets/no-cover.svg'}
|
fallbackSrc={coverSvgUrl}
|
||||||
/>
|
/>
|
||||||
)}
|
|
||||||
</Center>
|
</Center>
|
||||||
</GridItem>
|
</GridItem>
|
||||||
<GridItem area="title">
|
<GridItem area="title">
|
||||||
|
Loading…
Reference in New Issue
Block a user