main
km0 2 years ago
parent 4f6c2e95b4
commit 671484be0f

@ -9,6 +9,8 @@ export default {
const logs = ref([""]); const logs = ref([""]);
const who = ref(""); const who = ref("");
const sent = ref(false);
const disabled = computed(() => { const disabled = computed(() => {
return [title, description, nature, logs, who].some((input) => input.value == ""); return [title, description, nature, logs, who].some((input) => input.value == "");
}); });
@ -25,12 +27,37 @@ export default {
who: who.value, who: who.value,
}), }),
}); });
sent.value = true;
title.value = "";
description.value = "";
nature.value = "";
logs.value = [""];
who.value = "";
}; };
return { title, description, nature, logs, who, disabled, submit }; return { title, description, nature, logs, who, disabled, submit, sent };
}, },
template: ` template: `
<section class='recipe'> <section class='recipe'>
<div v-if="sent">
<div class="entry">
Thanks for sharing!
Your entry is being added to the cookbook.
</div>
<div class="entry">
<button @click="sent = false">Send another</button>
</div>
</div>
<div v-else>
<div class="entry"> <div class="entry">
<label for="title">Title</label> <label for="title">Title</label>
<input type="text" v-model='title'/> <input type="text" v-model='title'/>
@ -60,6 +87,7 @@ export default {
<div class="entry"> <div class="entry">
<button @click="submit" class="submit" :disabled="disabled">Submit</button> <button @click="submit" class="submit" :disabled="disabled">Submit</button>
</div> </div>
</div>
</section> </section>
<!-- <dl> <!-- <dl>

@ -24,7 +24,7 @@ export default {
template: ` template: `
<div class="cookbook"> <div class="cookbook">
<section class="recipe" v-for="(recipe, index) in recipes" :style="style(index)" @click="browse()"> <section class="recipe" v-for="(recipe, index) in recipes" :style="style(index)" @click="browse()" :key="recipe">
<h3>{{recipe.title}}</h3> <h3>{{recipe.title}}</h3>
<p>{{recipe.description}}</p> <p>{{recipe.description}}</p>
<div>{{recipe.nature}}</div> <div>{{recipe.nature}}</div>

@ -106,4 +106,5 @@ label {
left: 0; left: 0;
background-color: #e6b0aa; background-color: #e6b0aa;
cursor: pointer; cursor: pointer;
user-select: none;
} }

Loading…
Cancel
Save