fix(PlayerCard): List 滚动闪烁

feature/artists
mackt 7 months ago
parent 140aba42f6
commit 507fe08cb6

@ -8,7 +8,7 @@ import clientHttp from '@/utils/request/client';
import styles from './index.module.css'; import styles from './index.module.css';
import Lrc from './Lrc'; import Lrc from './Lrc';
import SongCardList from './widget/SongList'; import SongList from './widget/SongList';
import { Header } from '@/components'; import { Header } from '@/components';
import { useAudioStore } from '@/store'; import { useAudioStore } from '@/store';
@ -150,7 +150,7 @@ export default function PlayerCard({ show, className }: Prop) {
</button> </button>
<div className="w-full mt-15px ml-[-18px] overflow-hidden"> <div className="w-full mt-15px ml-[-18px] overflow-hidden">
<SongCardList height={height} songList={playQueue} listInfo={{ type: 'playerCard', id: null }} /> <SongList height={height} songList={playQueue} listInfo={{ type: 'playerCard', id: null }} />
</div> </div>
</div> </div>
</div> </div>

@ -25,7 +25,6 @@ interface Props {
/** 收藏按钮的显示逻辑 always: 总是显示 playing: 播放时显示 */ /** 收藏按钮的显示逻辑 always: 总是显示 playing: 播放时显示 */
collectType?: 'always' | 'playing'; collectType?: 'always' | 'playing';
className?: string; className?: string;
style?: React.CSSProperties;
} }
export default function SongCardList({ height, listInfo, songList, className, collectType = 'always', style }: Props) { export default function SongCardList({ height, listInfo, songList, className, collectType = 'always', style }: Props) {
@ -66,12 +65,11 @@ export default function SongCardList({ height, listInfo, songList, className, co
setAudioId(id); setAudioId(id);
}; };
function Item({ index }: { index: number }) { function Item({ index, style }: { index: number; style: React.CSSProperties }) {
const item = songList[index]; const item = songList[index];
return ( return (
<div> <div key={item?.id} style={style}>
<SongCard <SongCard
key={item?.id}
{...item} {...item}
playState={playState} playState={playState}
showEq={item?.id === audioId} showEq={item?.id === audioId}

Loading…
Cancel
Save