Speiseplan der Mensen der Georg-August-Universität Göttingen https://mensa.schneider-hosting.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.2 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. <template>
  2. <div class="hello">
  3. <div class="meal" v-for="meal in meals">
  4. <h3>{{meal.category}}</h3>
  5. <p>{{meal.title}}</p>
  6. </div>
  7. </div>
  8. </template>
  9. <script>
  10. export default {
  11. name: 'mensa',
  12. data () {
  13. return {
  14. meals: [],
  15. days: [1, 2, 3, 4, 5, 6],
  16. dayOfWeek: {
  17. 1: 'Montag',
  18. 2: 'Dienstag',
  19. 3: 'Mittwoch',
  20. 4: 'Donnerstag',
  21. 5: 'Freitag',
  22. 6: 'Samstag'
  23. }
  24. }
  25. },
  26. watch: {
  27. '$route': function () {
  28. if (!this.$route.fullPath.endsWith('/')) {
  29. this.$router.replace(this.$route.fullPath + '/')
  30. }
  31. if (!this.$route.params.tag) {
  32. this.$router.push('' + new Date().getDay())
  33. }
  34. this.loadMeals()
  35. }
  36. },
  37. methods: {
  38. loadMeals () {
  39. fetch(`/static/${this.$route.params.mensa}.${this.$route.params.tag}.json`)
  40. .then(res => res.json())
  41. .then(menu => { this.meals = menu.meals })
  42. }
  43. },
  44. created () {
  45. this.$router.replace(`/zentralmensa/${new Date().getDay()}`)
  46. this.loadMeals()
  47. }
  48. }
  49. </script>
  50. <style>
  51. .meal{
  52. margin: 2em 0;
  53. }
  54. .meal>h3{
  55. margin-bottom:0em;
  56. }
  57. .meal>p{
  58. margin-top: 0.4em;
  59. }
  60. </style>