fix(search): fix some small bugs

This commit is contained in:
Valentin Kaelin 2020-08-25 16:36:36 +02:00
parent 2a03163a14
commit b3b27d0223
2 changed files with 10 additions and 3 deletions

View file

@ -58,6 +58,7 @@
<SearchFormDropdownPlayer
v-for="(player, index) in recentSearchesSliced"
:key="player.name + player.region"
@close="close"
@mousemove.native="onHover(index + 1)"
:selected="index === selected - 1"
:player="player"
@ -66,6 +67,7 @@
</template>
<template v-else-if="favorites.length === 0">
<SearchFormDropdownPlayer
@close="close"
@mousemove.native="onHover(1)"
:player="{name: 'Alderiate', icon: 1150, region: 'euw'}"
:selected="selected === 1"
@ -87,6 +89,7 @@
<SearchFormDropdownPlayer
v-for="(player, index) in favorites"
:key="player.name + player.region"
@close="close"
@mousemove.native="onHover(index + recentSearchesCount + 1)"
:player="player"
:selected="index === selected - 1 - recentSearchesCount"
@ -246,12 +249,12 @@ export default {
this.selected = this.selected + 1 > this.totalCount ? 1 : this.selected + 1
this.onArrow()
},
async onHover(id) {
onHover(id) {
this.selected = id
if (this.$refs.searches !== document.activeElement) {
await this.$nextTick()
if (this.$refs.searches && this.$refs.searches !== document.activeElement) {
this.$refs.searches.focus()
this.onArrow()
}
},
onOptionSelect() {

View file

@ -1,5 +1,6 @@
<template>
<router-link
@click.native="close"
:to="{ name: 'summoner', params: { region: player.region, name: player.name }}"
:title="player.name"
:class="selected ? 'bg-blue-760' : 'bg-blue-900'"
@ -66,6 +67,9 @@ export default {
},
methods: {
close() {
this.$emit('close')
},
closeClick() {
if (this.favoritesList) {
this.updateFavorite(this.player)