From f2ce1a7d4be8f2a38d2a0c5b8dea1e931cf82e24 Mon Sep 17 00:00:00 2001 From: Daniel Morgenstern Date: Wed, 12 Sep 2018 11:46:55 +0200 Subject: [PATCH] avoid searchbar shadow on goHome() --- src/App.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/App.vue b/src/App.vue index 3da0166..8982c5c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -249,22 +249,26 @@ export default class App extends Vue { EventBus.$on(Events.TRIGGER_FILTER_SEARCH, (args: { filters: Searchable[], query: string }) => { if (this.$refs.searchbar && this.$refs.searchbar.selectedItems) { - while (this.$refs.searchbar.selectedItems.length > 0) { - this.$refs.searchbar.selectedItems.pop(); - } + this.clearSearchBar(); this.$refs.searchbar.selectedItems.push(...args.filters); } }); } + private clearSearchBar() : void { + while (this.$refs.searchbar.selectedItems.length > 0) { + this.$refs.searchbar.selectedItems.pop(); + } + } + private get searchInput(): HTMLInputElement { return this.$refs.searchbar.$el.querySelector('input'); } private goHome(): void { router.push('/'); - this.$refs.searchbar.reset(); + this.clearSearchBar(); } private loadPackages(): void {