diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2018-05-21 13:09:05 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2018-12-13 16:59:33 +0100 |
| commit | aea0fa999fd09951835b2d74c53137624f46929e (patch) | |
| tree | 3d806b7b5c5dd8b95fd07d6f3402d2231cf981d4 /src/Home.vue | |
| parent | 73e2c234f2f52357b21fd9fe9b956eeabb8ddc62 (diff) | |
| download | brokentalents-aea0fa999fd09951835b2d74c53137624f46929e.tar.gz brokentalents-aea0fa999fd09951835b2d74c53137624f46929e.zip | |
major redesign
Diffstat (limited to 'src/Home.vue')
| -rw-r--r-- | src/Home.vue | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/Home.vue b/src/Home.vue index 888d6d5..4983b5a 100644 --- a/src/Home.vue +++ b/src/Home.vue @@ -1,11 +1,7 @@ <template> - <b-tabs v-model="tabIndex" expanded type="is-toggle" > - <b-tab-item label="Blitz"> - <blitz-tab :reportService="reportService"></blitz-tab> - </b-tab-item> - - <b-tab-item label="Battle Royale"> - <battle-royale-tab :reportService="reportService"></battle-royale-tab> + <b-tabs v-model="tabIndex" expanded type="is-toggle"> + <b-tab-item v-for="mode in modes" :label="getMode(mode)"> + <mode-tab :reportService="reportService"></mode-tab> </b-tab-item> </b-tabs> </div> @@ -14,29 +10,31 @@ <script> import Vue from 'vue'; -import BlitzTab from './BlitzTab.vue'; -import BattleRoyaleTab from './BattleRoyaleTab.vue'; -import ReportService from './report-service.js'; +import ModeTab from './ModeTab.vue'; +import * as maps from './maps/maps'; export default Vue.component('home', { props: [ 'reportService' ], data: function() { return { + modes: this.reportService.getModes(), + getMode: maps.getMode, }; }, computed: { tabIndex: { get: function() { - return this.$route.query.tab; + return this.reportService.getModes().indexOf(this.$route.query.mode); }, - set: function(value) { - this.$router.push({ query: { tab: value }}); + set: function(index) { + const mode = this.reportService.getModes()[index]; + const query = Object.assign({}, this.$route.query, { mode: mode }); + this.$router.push({ query }); }, }, }, components: { - BlitzTab, - BattleRoyaleTab, + ModeTab, }, }); </script> |
