Add support for custom appList in search

This commit is contained in:
Sam Carlton 2020-09-21 18:03:25 -05:00
parent c0d54aa8ce
commit 76ae4fe15c

View file

@ -116,6 +116,10 @@ import appList from '~/assets/app-list.json'
export default { export default {
props: { props: {
appList: {
type: Array,
default: () => appList
},
quickButtons: { quickButtons: {
type: Array, type: Array,
default: () => [ default: () => [
@ -144,7 +148,7 @@ export default {
}, },
data: function () { data: function () {
return { return {
appList, // appList,
query: '', query: '',
// results: [], // results: [],
titleStartsWithResults: [], titleStartsWithResults: [],
@ -155,7 +159,7 @@ export default {
}, },
computed: { computed: {
results () { results () {
if (!this.hasSearchInputText) return appList if (!this.hasSearchInputText) return this.appList
return [ return [
...this.titleStartsWithResults, ...this.titleStartsWithResults,
@ -213,7 +217,7 @@ export default {
}, },
scrollInputToTop () { scrollInputToTop () {
scrollIntoView(this.$refs['search'], { scrollIntoView(this.$refs['search'], {
block: 'start', block: 'start',
behavior: 'smooth' behavior: 'smooth'
}) })
}, },
@ -221,7 +225,7 @@ export default {
// Clear any results from before // Clear any results from before
this.titleStartsWithResults = [] this.titleStartsWithResults = []
this.titleContainsResults = [] this.titleContainsResults = []
this.sectionNameContainsResults = [] this.sectionContainsResults = []
// Snap results scroll position back to top // Snap results scroll position back to top