search page only appears on enter

This commit is contained in:
Core 2022-09-11 03:13:54 +01:00
parent ce598e8b2c
commit 350521ddaf
No known key found for this signature in database
GPG key ID: 2AB8327FBA02D1C0
4 changed files with 9 additions and 6 deletions

View file

@ -25,6 +25,7 @@ const app = new Vue({
cursor: -1, cursor: -1,
hints: [], hints: [],
showHints: false, showHints: false,
showSearchView: false,
results: {}, results: {},
resultsSocial: {}, resultsSocial: {},
resultsLibrary: {}, resultsLibrary: {},
@ -1904,6 +1905,8 @@ const app = new Vue({
async getSearchHints() { async getSearchHints() {
if (this.search.term == "") { if (this.search.term == "") {
this.search.hints = []; this.search.hints = [];
this.search.showHints = true
this.search.showSearchView = false
return; return;
} }
let hints = await ( let hints = await (

View file

@ -280,7 +280,7 @@
<input type="search" spellcheck="false" @click="$root.appRoute('search');search.showHints = true" <input type="search" spellcheck="false" @click="$root.appRoute('search');search.showHints = true"
@focus="search.showHints = true" @focus="search.showHints = true"
@blur="setTimeout(()=>{if(hintscontext != true){search.showHints = false} }, 300)" @blur="setTimeout(()=>{if(hintscontext != true){search.showHints = false} }, 300)"
v-on:keyup.enter="searchQuery(search.hints[search.cursor]?.content ?? search.hints[search.cursor]?.searchTerm ?? search.term);search.showHints = false;search.cursor = -1" @change="$root.appRoute('search');" v-on:keyup.enter="searchQuery(search.hints[search.cursor]?.content ?? search.hints[search.cursor]?.searchTerm ?? search.term);search.showHints = false;search.showSearchView = true;search.cursor = -1" @change="$root.appRoute('search');"
v-on:keyup="searchCursor" v-on:keyup="searchCursor"
@input="getSearchHints()" @input="getSearchHints()"
:placeholder="$root.getLz('term.search') + '...'" v-model="search.term" ref="searchInput" :placeholder="$root.getLz('term.search') + '...'" v-model="search.term" ref="searchInput"
@ -294,7 +294,7 @@
</button> </button>
<template v-for="(item, position) in search.hints.filter((a) => {return a.content != null})"> <template v-for="(item, position) in search.hints.filter((a) => {return a.content != null})">
<mediaitem-smarthints :item="item.content" :position="position"> </mediaitem-smarthints> <mediaitem-smarthints :item="item.content" :position="position"> </mediaitem-smarthints>
</template> </template>
</div> </div>
</div> </div>
</div> </div>

View file

@ -10,7 +10,7 @@
@click="$root.appRoute('search');$root.search.showHints = true" @click="$root.appRoute('search');$root.search.showHints = true"
@focus="$root.search.showHints = true" @focus="$root.search.showHints = true"
@blur="$root.setTimeout(()=>{if($root.hintscontext != true){$root.search.showHints = false} }, 300)" @blur="$root.setTimeout(()=>{if($root.hintscontext != true){$root.search.showHints = false} }, 300)"
v-on:keyup.enter="$root.searchQuery($root.search.hints[$root.search.cursor]?.content ?? $root.search.hints[$root.search.cursor]?.searchTerm ?? $root.search.term);$root.search.showHints = false;$root.search.cursor = -1" v-on:keyup.enter="$root.searchQuery($root.search.hints[$root.search.cursor]?.content ?? $root.search.hints[$root.search.cursor]?.searchTerm ?? $root.search.term);$root.search.showHints = false;$root.search.showSearchView = true;$root.search.cursor = -1"
v-on:keyup="$root.searchCursor" v-on:keyup="$root.searchCursor"
@change="$root.appRoute('search');" @change="$root.appRoute('search');"
@input="$root.getSearchHints()" @input="$root.getSearchHints()"
@ -34,7 +34,7 @@
</button> </button>
<template v-for="(item, position) in $root.search.hints.filter((a) => {return a.content != null})"> <template v-for="(item, position) in $root.search.hints.filter((a) => {return a.content != null})">
<mediaitem-smarthints :item="item.content" :position="position"> </mediaitem-smarthints> <mediaitem-smarthints :item="item.content" :position="position"> </mediaitem-smarthints>
</template> </template>
</div> </div>
</div> </div>
</div> </div>

View file

@ -4,7 +4,7 @@
<div class="search-input--icon"></div> <div class="search-input--icon"></div>
<input type="search" spellcheck="false" @focus="$root.search.showHints = true" <input type="search" spellcheck="false" @focus="$root.search.showHints = true"
@blur="$root.setTimeout(()=>{if($root.hintscontext != true){$root.search.showHints = false} }, 300)" @blur="$root.setTimeout(()=>{if($root.hintscontext != true){$root.search.showHints = false} }, 300)"
v-on:keyup.enter="$root.searchQuery($root.search.hints[$root.search.cursor]?.content ?? $root.search.hints[$root.search.cursor]?.searchTerm ?? $root.search.term);$root.search.showHints = false" @input="$root.getSearchHints()" v-on:keyup.enter="$root.searchQuery($root.search.hints[$root.search.cursor]?.content ?? $root.search.hints[$root.search.cursor]?.searchTerm ?? $root.search.term);$root.search.showHints = false; $root.search.showSearchView = true" @input="$root.getSearchHints()"
:placeholder="$root.getLz('term.search') + '...'" v-model="$root.search.term" :placeholder="$root.getLz('term.search') + '...'" v-model="$root.search.term"
class="search-input" /> class="search-input" />
@ -33,7 +33,7 @@
$root.getLz("term.library") }} $root.getLz("term.library") }}
</button> </button>
</div> </div>
<div v-if="search != null && search != [] && search.term != ''"> <div v-if="search != null && search != [] && search.term != '' && $root.search.showSearchView">
<template v-if="searchType == 'catalog'"> <template v-if="searchType == 'catalog'">
<h3>{{app.getLz('term.topResult')}}</h3> <h3>{{app.getLz('term.topResult')}}</h3>
<mediaitem-scroller-horizontal <mediaitem-scroller-horizontal