mirror of
https://github.com/mmjee/Piped-Material.git
synced 2024-12-06 19:26:36 +01:00
Potential search menu improvements
This commit is contained in:
+11
-10
@@ -31,7 +31,7 @@ export default {
|
||||
select: '',
|
||||
searchText: '',
|
||||
requestInProgress: false,
|
||||
searchSuggestions: [],
|
||||
actualSuggestions: [],
|
||||
|
||||
mdiMagnify
|
||||
}
|
||||
@@ -61,6 +61,15 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
searchSuggestions () {
|
||||
if (this.searchText.length === 0) {
|
||||
return this.actualSuggestions
|
||||
} else {
|
||||
return [this.searchText].concat(this.actualSuggestions)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
refreshSuggestions: _debounce(async function refreshSuggestions () {
|
||||
@@ -72,15 +81,7 @@ export default {
|
||||
}
|
||||
})
|
||||
|
||||
{
|
||||
const idx = suggestions.indexOf(this.searchText)
|
||||
if (idx !== -1) {
|
||||
suggestions.splice(idx, 1)
|
||||
}
|
||||
}
|
||||
suggestions.unshift(this.searchText)
|
||||
|
||||
this.searchSuggestions = suggestions
|
||||
this.actualSuggestions = suggestions
|
||||
this.requestInProgress = false
|
||||
}, 500)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user