Add code to store search query and perform search
This commit is contained in:
parent
5066ce695d
commit
ef6e52c0cb
10
karaokatalog/ui/static/model/search.js
Normal file
10
karaokatalog/ui/static/model/search.js
Normal file
@ -0,0 +1,10 @@
|
||||
export default {
|
||||
query: null,
|
||||
|
||||
apply(songs) {
|
||||
const normalizedQuery = this.query?.trim()?.toLowerCase()
|
||||
return normalizedQuery ? songs?.filter(
|
||||
song => song.title?.toLowerCase()?.includes(normalizedQuery) || song.artist?.toLowerCase()?.includes(normalizedQuery)
|
||||
) : songs
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user