Browse Source

Add firt content

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

15
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,12 +17,18 @@ export default {
meals: []
}
},
watch: {$route: 'loadMeals'},
created () {
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 })
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->

Loading…
Cancel
Save