File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/renderer/components/player Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 96
96
</div >
97
97
</div >
98
98
<div class =" audio-button" >
99
- <div class =" audio-volume custom-slider" >
99
+ <div class =" audio-volume custom-slider" @wheel.prevent = " handleVolumeWheel " >
100
100
<div class =" volume-icon" @click =" mute" >
101
101
<i class =" iconfont" :class =" getVolumeIcon" ></i >
102
102
</div >
103
103
<div class =" volume-slider" >
104
+ <div class =" volume-percentage" >{{ Math.round(volumeSlider) }}%</div >
104
105
<n-slider v-model:value =" volumeSlider" :step =" 0.01" :tooltip =" false" vertical ></n-slider >
105
106
</div >
106
107
</div >
@@ -276,6 +277,14 @@ const mute = () => {
276
277
}
277
278
};
278
279
280
+ // 鼠标滚轮调整音量
281
+ const handleVolumeWheel = (e : WheelEvent ) => {
282
+ // 向上滚动增加音量,向下滚动减少音量
283
+ const delta = e .deltaY < 0 ? 5 : - 5 ;
284
+ const newValue = Math .min (Math .max (volumeSlider .value + delta , 0 ), 100 );
285
+ volumeSlider .value = newValue ;
286
+ };
287
+
279
288
// 播放模式
280
289
const playMode = computed (() => playerStore .playMode );
281
290
const playModeIcon = computed (() => {
@@ -476,6 +485,12 @@ const openPlayListDrawer = () => {
476
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 ;
477
486
@apply bg-light dark :bg- gray- 800;
478
487
@apply border border-gray-200 dark :border- gray- 700;
488
+
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;
491
+ @apply border border-gray-200 dark :border- gray- 700;
492
+ white-space : nowrap ;
493
+ }
479
494
}
480
495
}
481
496
You can’t perform that action at this time.
0 commit comments