mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
refactor: use 1 array instead of 2 for championsList
This commit is contained in:
parent
2a196c9115
commit
cecd6115a0
1 changed files with 7 additions and 10 deletions
|
|
@ -87,7 +87,7 @@
|
||||||
class="px-2 py-3 text-white text-sm"
|
class="px-2 py-3 text-white text-sm"
|
||||||
>{{ champion.gameLength|secToTime }}</td>
|
>{{ champion.gameLength|secToTime }}</td>
|
||||||
<td
|
<td
|
||||||
:class="{'rounded-br-lg': index === championsFull.length - 1}"
|
:class="{'rounded-br-lg': index === championsToDisplay.length - 1}"
|
||||||
class="px-2 py-3 text-white text-sm"
|
class="px-2 py-3 text-white text-sm"
|
||||||
>{{ champion.lastPlayed }}</td>
|
>{{ champion.lastPlayed }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -167,13 +167,17 @@ export default {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
championsFull: [],
|
championsFull: [],
|
||||||
championsToDisplay: [],
|
|
||||||
sortProps: 'index',
|
sortProps: 'index',
|
||||||
order: -1
|
order: -1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
championsToDisplay() {
|
||||||
|
return this.championsFull.filter(c => {
|
||||||
|
return c.champion.name.toLowerCase().includes(this.search.toLowerCase())
|
||||||
|
})
|
||||||
|
},
|
||||||
totalGames() {
|
totalGames() {
|
||||||
return this.champions.reduce((agg, champ) => agg + champ.count, 0)
|
return this.champions.reduce((agg, champ) => agg + champ.count, 0)
|
||||||
}
|
}
|
||||||
|
|
@ -182,15 +186,10 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
champions() {
|
champions() {
|
||||||
this.updateChampionsList()
|
this.updateChampionsList()
|
||||||
},
|
|
||||||
search() {
|
|
||||||
this.championsToDisplay = this.championsFull.filter(c => {
|
|
||||||
return c.champion.name.toLowerCase().includes(this.search.toLowerCase())
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
created() {
|
||||||
this.updateChampionsList()
|
this.updateChampionsList()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -244,8 +243,6 @@ export default {
|
||||||
show: true
|
show: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.championsToDisplay = this.championsFull
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue