LeagueStats/client/src/views/SummonerChampions.vue

54 lines
1.1 KiB
Vue
Raw Normal View History

<template>
<div>
<div class="mt-3 min-h-screen">
<ChampionsSearch @search-champions="updateSearch" class="mt-4" />
2019-12-21 16:56:31 +00:00
<ChampionsTable
v-if="champions.length && championsLoaded"
:champions="champions"
:search="searchChampions"
class="mt-6"
2019-12-21 16:56:31 +00:00
/>
</div>
</div>
</template>
2019-12-21 16:56:31 +00:00
<script>
import { mapActions, mapState } from 'vuex'
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: {
ChampionsSearch,
2019-12-21 16:56:31 +00:00
ChampionsTable,
},
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: {
updateSearch(search) {
this.searchChampions = search
},
2019-12-21 16:56:31 +00:00
...mapActions('summoner', ['championStats']),
}
}
</script>