@@ -270,6 +270,43 @@ const batch = useMultiSelect(sortedItems, {
270270});
271271const { deleteConfirmOpen, deleteDialogTitle, deleteDialogContent } = batch ;
272272
273+ /** 是否使用紧凑列表样式 */
274+ const isCompactList = computed (() => settings .appearance .songListStyle === " compact" );
275+
276+ /**
277+ * 计算歌曲行样式
278+ * @param item - 歌曲数据
279+ * @returns 行容器的 class 列表
280+ */
281+ const trackRowClass = (item : Track ): string [] => {
282+ const selected = batch .active .value && batch .selectedIds .value .has (item .id );
283+ const playing = playingId .value === item .id ;
284+
285+ if (isCompactList .value ) {
286+ return [
287+ " group flex items-center gap-3 pl-3 pr-4 h-14 rounded-lg cursor-pointer transition-colors duration-150" ,
288+ batch .active .value
289+ ? selected
290+ ? " bg-primary/10"
291+ : " hover:bg-on-surface/5"
292+ : playing
293+ ? " bg-primary/14"
294+ : " hover:bg-on-surface/6 active:bg-on-surface/10" ,
295+ ];
296+ }
297+
298+ return [
299+ " group flex items-center gap-3 pl-3 pr-6 h-19 rounded-xl cursor-pointer border-2 border-solid transition-[background-color,border-color] duration-200" ,
300+ batch .active .value
301+ ? selected
302+ ? " bg-primary/10 border-primary/30"
303+ : " bg-surface-panel border-primary/12 hover:border-primary/20 hover:bg-on-surface/5"
304+ : playing
305+ ? " bg-primary/16 border-primary/40"
306+ : " bg-surface-panel border-primary/12 hover:border-primary/30 hover:bg-on-surface/8 active:bg-on-surface/12" ,
307+ ];
308+ };
309+
273310/** 添加到歌单相关 */
274311const {
275312 open : pickerOpen,
@@ -381,7 +418,7 @@ defineExpose({
381418 <SVirtualList
382419 ref="virtualListRef"
383420 :items =" sortedItems "
384- :item-height =" 88 "
421+ :item-height =" isCompactList ? 56 : 88 "
385422 :padding-bottom =" isFloatingPlayerBar ? PLAYER_BAR_GAP : 80 "
386423 :get-item-key =" (item : Track ) => item .id "
387424 item-fixed
@@ -504,7 +541,12 @@ defineExpose({
504541 <!-- 普通模式 -->
505542 <div
506543 v-else
507- class =" flex items-center gap-3 pl-3 pr-6 mx-3 h-10 border-2 border-solid border-transparent text-sm text-on-surface-variant/60"
544+ class =" flex items-center gap-3 text-sm text-on-surface-variant/60"
545+ :class ="
546+ isCompactList
547+ ? 'pl-3 pr-4 mx-3 h-9'
548+ : 'pl-3 pr-6 mx-3 h-10 border-2 border-solid border-transparent'
549+ "
508550 >
509551 <div v-if =" showIndex" class =" w-8 shrink-0 flex items-center justify-center" >
510552 <span >#</span >
@@ -576,19 +618,10 @@ defineExpose({
576618 </template >
577619 <!-- 列表项 -->
578620 <template #default =" { item , index }: { item: Track ; index : number } " >
579- <div class =" px-3 pb-3" >
621+ <div : class =" isCompactList ? ' px-3' : 'px-3 pb-3' " >
580622 <div
581623 data-song-item
582- class =" group flex items-center gap-3 pl-3 pr-6 h-19 rounded-xl cursor-pointer border-2 border-solid transition-[background-color,border-color] duration-200"
583- :class ="
584- batch.active.value
585- ? batch.selectedIds.value.has(item.id)
586- ? 'bg-primary/10 border-primary/30'
587- : 'bg-surface-panel border-primary/12 hover:border-primary/20 hover:bg-on-surface/5'
588- : playingId === item.id
589- ? 'bg-primary/16 border-primary/40'
590- : 'bg-surface-panel border-primary/12 hover:border-primary/30 hover:bg-on-surface/8 active:bg-on-surface/12'
591- "
624+ :class =" trackRowClass(item)"
592625 @click =" batch.active.value ? batch.toggle(item.id) : undefined"
593626 @dblclick =" onTrackDblClick(item, index)"
594627 @contextmenu =" contextTrack = item"
@@ -618,7 +651,8 @@ defineExpose({
618651 <template v-else >
619652 <span
620653 v-if =" playingId !== item.id"
621- class =" text-sm font-bold tabular-nums group-hover:opacity-0 transition-opacity duration-300"
654+ class =" font-bold tabular-nums group-hover:opacity-0 transition-opacity duration-300"
655+ :class =" isCompactList ? 'text-xs' : 'text-sm'"
622656 >
623657 {{ index + 1 }}
624658 </span >
@@ -639,12 +673,18 @@ defineExpose({
639673 </div >
640674 <!-- 信息 -->
641675 <div class =" flex-1 min-w-0 flex items-center gap-3" >
642- <SImg :src =" item .cover " class="size-12 rounded-lg shrink-0" />
676+ <SImg
677+ :src =" item .cover "
678+ :class =" [' shrink-0' , isCompactList ? ' size-9 rounded-md' : ' size-12 rounded-lg' ] "
679+ />
643680 <div class =" flex-1 min-w-0" >
644681 <div class =" flex items-baseline gap-1.5 min-w-0" >
645682 <span
646- class =" text-base font-medium truncate"
647- :class =" playingId === item.id ? 'text-primary' : ''"
683+ :class =" [
684+ 'font-medium truncate',
685+ isCompactList ? 'text-sm' : 'text-base',
686+ playingId === item.id ? 'text-primary' : '',
687+ ]"
648688 >
649689 {{ item.title }}
650690 </span >
@@ -666,8 +706,11 @@ defineExpose({
666706 </span >
667707 </div >
668708 <div
669- class =" text-sm mt-1 truncate flex items-center gap-1"
670- :class =" playingId === item.id ? 'text-primary/70' : 'text-on-surface-variant'"
709+ :class =" [
710+ 'truncate flex items-center gap-1',
711+ isCompactList ? 'text-xs mt-0.5' : 'text-sm mt-1',
712+ playingId === item.id ? 'text-primary/70' : 'text-on-surface-variant',
713+ ]"
671714 >
672715 <STag
673716 v-if =" downloadStore .isDownloaded (item )"
0 commit comments