Browse Source

Add firt content

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

19
src/components/Tag.vue

@ -1,8 +1,11 @@
<template> <template>
<div class="hello"> <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> </div>
</template> </template>
@ -14,10 +17,16 @@ export default {
meals: [] meals: []
} }
}, },
watch: {$route: 'loadMeals'},
created () { 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(res => res.json())
.then(menu => {this.meals = menu.meals})
.then(menu => { this.meals = menu.meals })
}
} }
} }
</script> </script>

Loading…
Cancel
Save