diff options
author | Bastien Wirtz <bastien.wirtz@gmail.com> | 2022-07-11 22:07:48 +0200 |
---|---|---|
committer | Bastien Wirtz <bastien.wirtz@gmail.com> | 2022-07-11 22:07:48 +0200 |
commit | 9582b1871ac63d1e625ccf6c221bd1248a1c9d03 (patch) | |
tree | 3e2582b7a4134ce0c6ba4f6d835461fbd2f23205 /src | |
parent | ce391840e58d04f74ca1d411a4686801fc1a1a70 (diff) | |
download | homer-9582b1871ac63d1e625ccf6c221bd1248a1c9d03.tar.gz homer-9582b1871ac63d1e625ccf6c221bd1248a1c9d03.tar.zst homer-9582b1871ac63d1e625ccf6c221bd1248a1c9d03.zip |
Fix search widget
Diffstat (limited to 'src')
-rw-r--r-- | src/App.vue | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/App.vue b/src/App.vue index 43ba322..4120fe5 100644 --- a/src/App.vue +++ b/src/App.vue | |||
@@ -49,10 +49,10 @@ | |||
49 | <SearchInput | 49 | <SearchInput |
50 | class="navbar-item is-inline-block-mobile" | 50 | class="navbar-item is-inline-block-mobile" |
51 | :hotkey="searchHotkey()" | 51 | :hotkey="searchHotkey()" |
52 | @input="filterServices" | 52 | @input="filterServices($event.target?.value)" |
53 | @search-focus="showMenu = true" | 53 | @search-focus="showMenu = true" |
54 | @search-open="navigateToFirstService" | 54 | @search-open="navigateToFirstService($event?.target?.value)" |
55 | @search-cancel="filterServices" | 55 | @search-cancel="filterServices()" |
56 | /> | 56 | /> |
57 | </Navbar> | 57 | </Navbar> |
58 | </div> | 58 | </div> |
@@ -255,11 +255,12 @@ export default { | |||
255 | }); | 255 | }); |
256 | }, | 256 | }, |
257 | matchesFilter: function (item) { | 257 | matchesFilter: function (item) { |
258 | const needle = this.filter?.toLowerCase(); | ||
258 | return ( | 259 | return ( |
259 | item.name.toLowerCase().includes(this.filter) || | 260 | item.name.toLowerCase().includes(needle) || |
260 | (item.subtitle && item.subtitle.toLowerCase().includes(this.filter)) || | 261 | (item.subtitle && item.subtitle.toLowerCase().includes(needle)) || |
261 | (item.tag && item.tag.toLowerCase().includes(this.filter)) || | 262 | (item.tag && item.tag.toLowerCase().includes(needle)) || |
262 | (item.keywords && item.keywords.toLowerCase().includes(this.filter)) | 263 | (item.keywords && item.keywords.toLowerCase().includes(needle)) |
263 | ); | 264 | ); |
264 | }, | 265 | }, |
265 | navigateToFirstService: function (target) { | 266 | navigateToFirstService: function (target) { |
@@ -271,6 +272,7 @@ export default { | |||
271 | } | 272 | } |
272 | }, | 273 | }, |
273 | filterServices: function (filter) { | 274 | filterServices: function (filter) { |
275 | console.log(filter); | ||
274 | this.filter = filter; | 276 | this.filter = filter; |
275 | 277 | ||
276 | if (!filter) { | 278 | if (!filter) { |