update
This commit is contained in:
32
src/App.vue
32
src/App.vue
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user