|
|
@ -1,9 +1,9 @@ |
|
|
|
<template> |
|
|
|
<div class="hello"> |
|
|
|
<nav> |
|
|
|
<router-link v-for="day in days" :to="'/' + $route.params.mensa + '/' + day" :key="day">{{dayOfWeek[day]}}</router-link> |
|
|
|
</nav> |
|
|
|
<router-view></router-view> |
|
|
|
<div class="meal" v-for="meal in meals"> |
|
|
|
<h3>{{meal.category}}</h3> |
|
|
|
<p>{{meal.title}}</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
@ -12,6 +12,7 @@ export default { |
|
|
|
name: 'mensa', |
|
|
|
data () { |
|
|
|
return { |
|
|
|
meals: [], |
|
|
|
days: [1, 2, 3, 4, 5, 6], |
|
|
|
dayOfWeek: { |
|
|
|
1: 'Montag', |
|
|
@ -31,17 +32,33 @@ export default { |
|
|
|
if (!this.$route.params.tag) { |
|
|
|
this.$router.push('' + new Date().getDay()) |
|
|
|
} |
|
|
|
this.loadMeals() |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
if (!this.$route.fullPath.endsWith('/')) { |
|
|
|
this.$router.replace(this.$route.fullPath + '/') |
|
|
|
} |
|
|
|
if (!this.$route.params.tag) { |
|
|
|
this.$router.push('' + new Date().getDay()) |
|
|
|
methods: { |
|
|
|
loadMeals () { |
|
|
|
fetch(`/static/${this.$route.params.mensa}.${this.$route.params.tag}.json`) |
|
|
|
.then(res => res.json()) |
|
|
|
.then(menu => { this.meals = menu.meals }) |
|
|
|
} |
|
|
|
}, |
|
|
|
created () { |
|
|
|
this.$router.replace(`/zentralmensa/${new Date().getDay()}`) |
|
|
|
this.loadMeals() |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style> |
|
|
|
.meal{ |
|
|
|
margin: 2em 0; |
|
|
|
} |
|
|
|
|
|
|
|
.meal>h3{ |
|
|
|
margin-bottom:0em; |
|
|
|
} |
|
|
|
|
|
|
|
.meal>p{ |
|
|
|
margin-top: 0.4em; |
|
|
|
} |
|
|
|
|
|
|
|
<style></style> |
|
|
|
</style> |