This commit is contained in:
2019-07-01 20:58:02 +02:00
parent dae1a68ef8
commit dbca57d7e1
7 changed files with 102 additions and 21 deletions

View File

@@ -2,7 +2,7 @@
<div id="app">
<NavBar :activeType="type" @setType="setType"></NavBar>
<section class="section">
<TimeWindows :activeWindow="window" @setWindow="setWindow" ></TimeWindows>
<TimeWindows :activeWindow="window" @setWindow="setWindow"></TimeWindows>
<Chart :window="window" :type="type"></Chart>
</section>
</div>
@@ -23,13 +23,43 @@ export default {
window: {}
}
},
created() {
const { type, window } = this.$route.params
if (type) this.type = type
if (window) this.window = window
},
methods: {
setType(type) {
this.type = type
this.updateRoute()
},
setWindow(window) {
this.window = window
this.updateRoute()
},
updateRoute() {
this.$router.push({
name: 'view',
params: {
type: this.type,
window: this.window.label ? this.window.label.replace(' ', '-') : undefined
}
})
}
}
}
</script>
<style scoped>
#app {
height: 100%;
}
#app, .section {
display: flex;
flex-direction: column;
flex-grow: 1;
}
.section {
padding-bottom: 0;
padding-top: 0;
}
</style>