munch-ease-frontend/src/components/EditMealPage.vue

37 lines
813 B
Vue
Raw Normal View History

2024-01-13 02:00:15 +00:00
<template>
2024-01-13 23:09:15 +00:00
<div>
<input type="date" v-model="meal.date" />
<recipe-search-box @select-recipe="selectRecipe" />
</div>
2024-01-13 02:00:15 +00:00
</template>
<script>
2024-01-13 23:09:15 +00:00
import data from '@/data.js'
import RecipeSearchBox from './RecipeSearchBox.vue';
2024-01-13 02:00:15 +00:00
export default {
props: ['id'],
2024-01-13 23:09:15 +00:00
components: { RecipeSearchBox },
2024-01-13 02:00:15 +00:00
data() {
return {
meal: {
date: new Date(),
2024-01-13 23:09:15 +00:00
recipes: [{ name: 'Sar Tay' }],
2024-01-13 02:00:15 +00:00
chefs: [{ name: 'Ryan' }],
consumers: [{ name: 'Ryan' }, { name: 'Jacob' }],
}
2024-01-13 23:09:15 +00:00
};
},
beforeMount() {
if (this.id) {
this.meal = data.getMeal(this.id);
2024-01-13 02:00:15 +00:00
}
},
2024-01-13 23:09:15 +00:00
methods: {
selectRecipe(recipe) {
this.meal.recipe = recipe;
}
}
2024-01-13 02:00:15 +00:00
}
</script>