fix(Player): 修复拖动控件时误触父元素点击事件的问题 (#2444)

Co-authored-by: sc <sc@0x1247c14@gmail.com>
This commit is contained in:
12471220
2026-01-18 14:10:01 +08:00
committed by GitHub
parent c47d009526
commit c4f0c00a5e

View File

@@ -1,5 +1,5 @@
<template>
<div class="player" @click="toggleLyrics">
<div class="player" @click="handleClick" @mousedown="handleMouseDown">
<div
class="progress-bar"
:class="{
@@ -195,6 +195,11 @@ export default {
ButtonIcon,
VueSlider,
},
data() {
return {
mouseDownTarget: null,
};
},
computed: {
...mapState(['player', 'settings', 'data']),
currentTrack() {
@@ -227,6 +232,14 @@ export default {
methods: {
...mapMutations(['toggleLyrics']),
...mapActions(['showToast', 'likeATrack']),
handleClick(event) {
if (event.target == this.mouseDownTarget) {
this.toggleLyrics();
}
},
handleMouseDown(event) {
this.mouseDownTarget = event.target;
},
playPrevTrack() {
this.player.playPrevTrack();
},