[web] Set default values for uri and position to play a track

This commit is contained in:
Alain Nussbaumer 2024-03-25 15:25:00 +01:00
parent c312b2fdfe
commit 7adde0340e
2 changed files with 7 additions and 5 deletions

View File

@ -57,9 +57,9 @@ export default {
name: 'ListItemTrackSpotify', name: 'ListItemTrackSpotify',
components: { ModalDialogTrackSpotify }, components: { ModalDialogTrackSpotify },
props: { props: {
context_uri: { required: true, type: String }, context_uri: { default: '', type: String },
item: { required: true, type: Object }, item: { required: true, type: Object },
position: { required: true, type: Number } position: { default: 0, type: Number }
}, },
data() { data() {
return { show_details_modal: false } return { show_details_modal: false }
@ -67,7 +67,11 @@ export default {
methods: { methods: {
play() { play() {
if (this.item.is_playable) { if (this.item.is_playable) {
webapi.player_play_uri(this.context_uri, false, this.position) webapi.player_play_uri(
this.context_uri || this.item.uri,
false,
this.position
)
} }
} }
} }

View File

@ -44,8 +44,6 @@
v-for="track in tracks.items" v-for="track in tracks.items"
:key="track.id" :key="track.id"
:item="track" :item="track"
:position="0"
:context_uri="track.uri"
/> />
<VueEternalLoading v-if="query.type === 'track'" :load="search_next"> <VueEternalLoading v-if="query.type === 'track'" :load="search_next">
<template #loading> <template #loading>