File tree Expand file tree Collapse file tree 2 files changed +58
-4
lines changed
src/renderer/components/player Expand file tree Collapse file tree 2 files changed +58
-4
lines changed Original file line number Diff line number Diff line change 54
54
55
55
<n-popover v-if =" component" trigger =" hover" :z-index =" 99999999" placement =" top" :show-arrow =" false" >
56
56
<template #trigger >
57
- <div class =" function-button" @click =" mute" >
57
+ <div class =" function-button" @click =" mute" @wheel.prevent = " handleVolumeWheel " >
58
58
<i class =" iconfont" :class =" getVolumeIcon" ></i >
59
59
</div >
60
60
</template >
64
64
:step =" 0.01"
65
65
:tooltip =" false"
66
66
vertical
67
+ @wheel.prevent =" handleVolumeWheel"
67
68
></n-slider >
68
69
</div >
69
70
</n-popover >
@@ -183,6 +184,14 @@ const mute = () => {
183
184
}
184
185
};
185
186
187
+ // 鼠标滚轮调整音量
188
+ const handleVolumeWheel = (e : WheelEvent ) => {
189
+ // 向上滚动增加音量,向下滚动减少音量
190
+ const delta = e .deltaY < 0 ? 5 : - 5 ;
191
+ const newValue = Math .min (Math .max (volumeSlider .value + delta , 0 ), 100 );
192
+ volumeSlider .value = newValue ;
193
+ };
194
+
186
195
// 收藏相关
187
196
const isFavorite = computed (() => {
188
197
// 对于B站视频,使用ID匹配函数
@@ -529,6 +538,50 @@ const setMusicFull = () => {
529
538
.volume-slider-wrapper {
530
539
@apply p-2 py-4 rounded-xl bg-white dark :bg- dark- 100 shadow- lg bg- opacity- 90 backdrop- blur;
531
540
height : 160px ;
541
+
542
+ :deep (.n-slider ) {
543
+ --n-rail-height : 4px ;
544
+ --n-rail-color : theme (' colors.gray.200' );
545
+ --n-rail-color-dark : theme (' colors.gray.700' );
546
+ --n-fill-color : theme (' colors.green.500' );
547
+ --n-handle-size : 12px ;
548
+ --n-handle-color : theme (' colors.green.500' );
549
+
550
+ & .n-slider--vertical {
551
+ height : 100% ;
552
+
553
+ .n-slider-rail {
554
+ width : 4px ;
555
+ }
556
+
557
+ & :hover {
558
+ .n-slider-rail {
559
+ width : 6px ;
560
+ }
561
+
562
+ .n-slider-handle {
563
+ width : 14px ;
564
+ height : 14px ;
565
+ }
566
+ }
567
+ }
568
+
569
+ .n-slider-rail {
570
+ @apply overflow-hidden transition-all duration- 200;
571
+ @apply bg-gray-500 dark :bg- dark- 300 bg- opacity- 10 !important ;
572
+ }
573
+
574
+ .n-slider-handle {
575
+ @apply transition-all duration- 200;
576
+ opacity : 0 ;
577
+ }
578
+
579
+ & :hover {
580
+ .n-slider-handle {
581
+ opacity : 1 ;
582
+ }
583
+ }
584
+ }
532
585
}
533
586
534
587
// 播放列表样式
Original file line number Diff line number Diff line change @@ -483,12 +483,13 @@ const openPlayListDrawer = () => {
483
483
484
484
.volume-slider {
485
485
@apply absolute opacity-0 invisible transition-all duration-300 bottom- [30px ] left- 1/2 -translate-x- 1/2 h- [180px ] px-2 py-4 rounded-xl ;
486
- @apply bg-light dark :bg- gray - 800 ;
486
+ @apply bg-light dark :bg- dark - 200 ;
487
487
@apply border border-gray-200 dark :border- gray- 700;
488
488
489
489
.volume-percentage {
490
- @apply absolute -top- 6 left- 1/2 -translate-x- 1/2 text-xs font-medium bg-light dark :bg- gray - 800 px- 2 py- 1 rounded- md;
490
+ @apply absolute -top- 6 left- 1/2 -translate-x- 1/2 text-xs font-medium bg-light dark :bg- dark - 200 px- 2 py- 1 rounded- md;
491
491
@apply border border-gray-200 dark :border- gray- 700;
492
+ @apply text-gray-800 dark :text- white;
492
493
white-space : nowrap ;
493
494
}
494
495
}
@@ -597,7 +598,7 @@ const openPlayListDrawer = () => {
597
598
598
599
// 确保悬停时提示样式正确
599
600
.n-slider-tooltip {
600
- @apply bg-gray-800 text-white text-xs py-1 px-2 rounded ;
601
+ @apply bg-dark-200 text-white text-xs py-1 px-2 rounded ;
601
602
z-index : 999999 ;
602
603
}
603
604
}
You can’t perform that action at this time.
0 commit comments