Split search result rows
This commit is contained in:
1 parent
9cbf96564f
commit
a6e8bb51c5
2 files changed
+151
-11
No files matched your search
+8
-11
@@ -24,9 +24,14 @@ watch(query, (value) => {
|
||||
clearTimeout(debounceTimeout)
|
||||
debounceTimeout = setTimeout(() => {
|
||||
debouncedQuery.value = value
|
||||
debounceTimeout = undefined
|
||||
}, 300)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clearTimeout(debounceTimeout)
|
||||
})
|
||||
|
||||
const { data, status, error } = await useApiFetch<SearchResult[]>("/search", {
|
||||
query: { q: debouncedQuery, limit: 9 },
|
||||
watch: [debouncedQuery],
|
||||
@@ -110,18 +115,10 @@ const playResult = (result: SearchResult | Track) => {
|
||||
v-for="(result, index) in results"
|
||||
:key="`${result.type}-${result._id}`"
|
||||
>
|
||||
<TrackRow
|
||||
v-if="result.type === 'track'"
|
||||
:track="result as unknown as Track"
|
||||
<SearchRow
|
||||
:result="result"
|
||||
:index="index"
|
||||
show-image
|
||||
@play-album-at-index="playResult(result)"
|
||||
/>
|
||||
<TrackRow
|
||||
v-else
|
||||
:entity="result"
|
||||
:index="index"
|
||||
show-image
|
||||
@play="playResult(result)"
|
||||
/>
|
||||
</template>
|
||||
</section>
|
||||
|
||||
Reference in new issue
Block a user