2019-12-03 20:57:52 +00:00
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<div class="mt-3 min-h-screen">
|
2019-12-22 23:23:05 +00:00
|
|
|
<ChampionsSearch @search-champions="updateSearch" class="mt-4" />
|
2019-12-21 16:56:31 +00:00
|
|
|
<ChampionsTable
|
|
|
|
|
v-if="champions.length && championsLoaded"
|
|
|
|
|
:champions="champions"
|
2019-12-22 23:23:05 +00:00
|
|
|
:search="searchChampions"
|
|
|
|
|
class="mt-6"
|
2019-12-21 16:56:31 +00:00
|
|
|
/>
|
2019-12-03 20:57:52 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2019-12-21 16:56:31 +00:00
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { mapActions, mapState } from 'vuex'
|
2019-12-22 23:23:05 +00:00
|
|
|
import ChampionsSearch from '@/components/Summoner/Champions/ChampionsSearch.vue'
|
2019-12-21 16:56:31 +00:00
|
|
|
import ChampionsTable from '@/components/Summoner/Champions/ChampionsTable.vue'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
2019-12-22 23:23:05 +00:00
|
|
|
ChampionsSearch,
|
2019-12-21 16:56:31 +00:00
|
|
|
ChampionsTable,
|
|
|
|
|
},
|
|
|
|
|
|
2019-12-22 23:23:05 +00:00
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
searchChampions: ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2019-12-21 16:56:31 +00:00
|
|
|
computed: {
|
|
|
|
|
...mapState({
|
|
|
|
|
champions: state => state.summoner.infos.champions,
|
|
|
|
|
championsLoaded: state => state.summoner.championsLoaded
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
created() {
|
|
|
|
|
if (!this.championsLoaded) {
|
|
|
|
|
console.log('FETCH CHAMPIONS')
|
|
|
|
|
this.championStats()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
2019-12-22 23:23:05 +00:00
|
|
|
updateSearch(search) {
|
|
|
|
|
this.searchChampions = search
|
|
|
|
|
},
|
2019-12-21 16:56:31 +00:00
|
|
|
...mapActions('summoner', ['championStats']),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|