Browse Source

Use watcher instead of event for meal loading

vuex
Schneider 8 years ago
parent
commit
b1d37b3e3a
  1. 8
      src/App.vue

8
src/App.vue

@ -2,11 +2,11 @@
<div id="app">
<h1>Essen in Göttingen</h1>
Wo? <select v-model="where" @click="updateRoute">
Wo? <select v-model="where">
<option v-for="mensa in mensen" :value="mensa.url">{{mensa.name}}</option>
</select>
Wann? <select v-model="when" @click="updateRoute">
Wann? <select v-model="when">
<option v-for="day in days" :value="day" :key="day">{{dayOfWeek[day]}}</option>
</select>
<router-view></router-view>
@ -43,6 +43,10 @@ export default {
when: '' + new Date().getDay()
}
},
watch: {
'where': 'updateRoute',
'when': 'updateRoute'
},
methods: {
updateRoute () {
this.$router.push(`/${this.where}/${this.when}`)

Loading…
Cancel
Save