Skip to content

Commit b5bfe22

Browse files
committed
🐞 fix: 修复进度条 tooltip
1 parent 2505b52 commit b5bfe22

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/components/Player/PlayerSlider.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
:keyboard="false"
88
:format-tooltip="formatTooltip"
99
:tooltip="showTooltip"
10-
:show-tooltip="showSliderTooltip"
1110
:class="['player-slider', { drag: isDragging }]"
12-
@mouseenter="showSliderTooltip = true"
13-
@mouseleave="showSliderTooltip = false"
1411
@dragstart="startDrag"
1512
@dragend="endDrag"
1613
/>
@@ -35,7 +32,7 @@ const dragValue = ref(0);
3532
// 是否拖动
3633
const isDragging = ref(false);
3734
// 是否显示提示
38-
const showSliderTooltip = ref(false);
35+
// const showSliderTooltip = ref(false);
3936
4037
// 实时进度
4138
const sliderProgress = computed({
@@ -101,8 +98,8 @@ const setSeek = (value: number) => {
10198
10299
// 格式化提示
103100
const formatTooltip = (value: number) => {
104-
const nearestLyric = getCurrentLyric(value);
105-
return nearestLyric
101+
const nearestLyric = settingStore.progressLyricShow ? getCurrentLyric(value) : null;
102+
return nearestLyric?.text?.length
106103
? `${msToTime(value)} / ${nearestLyric.text.length > 30 ? nearestLyric.text.slice(0, 30) + "..." : nearestLyric.text}`
107104
: msToTime(value);
108105
};

src/components/Setting/PlaySetting.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
<n-text class="tip" :depth="3">程序启动时恢复上次播放位置</n-text>
3030
</div>
3131
<n-switch v-model:value="settingStore.memoryLastSeek" class="set" :round="false" />
32+
</n-card>
33+
<n-card class="set-item">
34+
<div class="label">
35+
<n-text class="name">进度条悬浮时显示歌词</n-text>
36+
</div>
37+
<n-switch v-model:value="settingStore.progressLyricShow" class="set" :round="false" />
3238
</n-card>
3339
<n-card class="set-item">
3440
<div class="label">

src/stores/setting.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ export interface SettingState {
258258
};
259259
/** 播放器跟随封面主色 */
260260
playerFollowCoverColor: boolean;
261+
/** 进度条悬浮时显示歌词 */
262+
progressLyricShow: boolean;
261263
}
262264

263265
export const useSettingStore = defineStore("setting", {
@@ -388,6 +390,7 @@ export const useSettingStore = defineStore("setting", {
388390
orpheus: false,
389391
},
390392
playerFollowCoverColor: true,
393+
progressLyricShow: true,
391394
}),
392395
getters: {
393396
/**

0 commit comments

Comments
 (0)