You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.3 KiB
JavaScript

3 years ago
export default {
3 years ago
name: "CookbookForm",
setup() {
const { ref } = Vue;
3 years ago
const title = ref("SI18.5 - Diffractive Cookbook");
const description = ref("Compiling and sharing methods for diffractive reading.");
const nature = ref("Methods");
const logs = ref([
"Do the assignment proposed by Femke",
"While doing the assignment, make sure to track your method with the help of the following form",
"This method will be used by others and applied on different resources",
]);
const who = ref("Grr, Kamo, Kimberley");
3 years ago
3 years ago
const submit = function () {
3 years ago
fetch("https://hub.xpub.nl/soupboat/cookbook/", {
3 years ago
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
title: title.value,
description: description.value,
nature: nature.value,
logs: logs.value,
who: who.value,
}),
});
};
return { title, description, nature, logs, who, submit };
3 years ago
},
template: `
3 years ago
<section class='recipe'>
<div class="entry">
<label for="title">Title</label>
<input type="text" v-model='title'/>
</div>
3 years ago
3 years ago
<div class="entry">
<label for="description">Description</label>
<textarea v-model="description"></textarea>
</div>
3 years ago
3 years ago
<div class="entry">
<label for="nature">Nature of the input</label>
<input type="text" v-model="nature" />
</div>
3 years ago
3 years ago
<div class="entry">
<label for="log">Process Log</label>
<textarea v-model="logs[index]" v-for="(log, index) in logs" :key="index" :placeholder="index + 1"></textarea>
<button class="add" @click="logs.push('')">+</button>
</div>
3 years ago
3 years ago
<div class="entry">
<label for="who">Who</label>
<input type="text" v-model="who" />
</div>
3 years ago
<div class="entry">
<button @click="submit" class="submit">Submit</button>
</div>
3 years ago
</section>
3 years ago
3 years ago
<!-- <dl>
3 years ago
<dt>Title</dt>
<dd>{{title}}</dd>
<dt>Description</dt>
<dd>{{description}}</dd>
<dt>Nature</dt>
<dd>{{nature}}</dd>
<dt>Log</dt>
<dd>
3 years ago
<ol>
3 years ago
<li v-for="log in logs">{{log}}</li>
3 years ago
</ol>
3 years ago
</dd>
<dt>Who</dt>
<dd>{{who}}</dd>
3 years ago
</dl> -->
3 years ago
`,
};