site: bind search component open to items.length
Šis iesūtījums ir iekļauts:
vecāks
cc25efc5f4
iesūtījums
bf21610576
2 izmainītas datnes ar 4 papildinājumiem un 5 izdzēšanām
|
@ -25,7 +25,7 @@ document.addEventListener('alpine:init', () => {
|
|||
return;
|
||||
if (currentWord === this.currentWord) {
|
||||
/* Show previous items, if any. */
|
||||
this.open = true;
|
||||
this.open = this.items.length > 0;
|
||||
return;
|
||||
}
|
||||
this.currentWord = currentWord;
|
||||
|
@ -35,12 +35,13 @@ document.addEventListener('alpine:init', () => {
|
|||
|
||||
if (!response.ok) {
|
||||
this.items = [];
|
||||
this.open = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this.activeItem = null;
|
||||
this.items = await response.json();
|
||||
this.open = true;
|
||||
this.open = this.items.length > 0;
|
||||
},
|
||||
|
||||
async fetchSuggestionsOnInput(evt) {
|
||||
|
|
Notiek ielāde…
Pievienot tabulu
Pievienot saiti
Atsaukties jaunā pieteikumā