Browse Source

Add firt content

vuex
Schneider 8 years ago
parent
commit
7d48f21738
  1. 19
      src/components/Tag.vue

19
src/components/Tag.vue

@ -1,8 +1,11 @@
<template>
<div class="hello">
<p>
{{ $route.fullPath }}
</p>
<table>
<tr v-for="meal in meals">
<td>{{meal.category}}</td>
<td>{{meal.title}}</td>
</tr>
</table>
</div>
</template>
@ -14,10 +17,16 @@ export default {
meals: []
}
},
watch: {$route: 'loadMeals'},
created () {
fetch(`/static/${this.$route.params.mensa}.${this.$route.params.tag}.json`)
this.loadMeals()
},
methods: {
loadMeals () {
fetch(`/static/${this.$route.params.mensa}.${this.$route.params.tag}.json`)
.then(res => res.json())
.then(menu => {this.meals = menu.meals})
.then(menu => { this.meals = menu.meals })
}
}
}
</script>

Loading…
Cancel
Save