diff --git a/apps/music/frontend/src/views/PlayerView.vue b/apps/music/frontend/src/views/PlayerView.vue
index b2b99c6..2c453e1 100644
--- a/apps/music/frontend/src/views/PlayerView.vue
+++ b/apps/music/frontend/src/views/PlayerView.vue
@@ -68,6 +68,8 @@
class="row"
:class="{ active: selectedId === p.id }"
@click="selectPiece(p.id)"
+ @dblclick="playPiece(p.id)"
+ title="单击切换 / 双击切换并播放"
>
{{ p.title }}
@@ -773,9 +775,12 @@ async function loadPiece(id) {
await nextTick()
const first = audioAttachments.value[0]
if (first && audioEl.value) {
- // 优先用 IDB 缓存的 blob URL(cache 关时同步返回网络 URL,零延迟)
audioEl.value.src = getAudioUrl(first.id)
- if (wasPlaying) audioEl.value.play().catch(() => {})
+ // 续播条件:之前正在播 / 双击强制要求 / forceNextPlay flag
+ if (wasPlaying || forceNextPlay) {
+ audioEl.value.play().catch(() => {})
+ }
+ forceNextPlay = false
} else if (audioEl.value) {
audioEl.value.removeAttribute('src')
audioEl.value.load()
@@ -804,6 +809,18 @@ function selectPiece(id) {
router.push({ name: 'piece', params: { id } })
}
+let forceNextPlay = false
+function playPiece(id) {
+ forceNextPlay = true
+ // 同 piece dblclick:URL 不变 watch 不触发 → 直接 play
+ if (id === selectedId.value && audioEl.value) {
+ audioEl.value.play().catch(() => {})
+ forceNextPlay = false
+ return
+ }
+ selectPiece(id)
+}
+
function attachmentUrl(id) { return attUrl(id) }
function togglePlay() {