From f8f722e8a2b63220907736782e547c5a06d88988 Mon Sep 17 00:00:00 2001 From: Cristiano Magro <cristiano.magro@vola.it> Date: Thu, 26 Dec 2024 15:02:08 +0100 Subject: [PATCH] add to list an item --- 03 - lists conditional/lists-cond-01-starting-setup/app.js | 6 +++++- 03 - lists conditional/lists-cond-01-starting-setup/index.html | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/03 - lists conditional/lists-cond-01-starting-setup/app.js b/03 - lists conditional/lists-cond-01-starting-setup/app.js index de49145..8c74258 100644 --- a/03 - lists conditional/lists-cond-01-starting-setup/app.js +++ b/03 - lists conditional/lists-cond-01-starting-setup/app.js @@ -1,6 +1,10 @@ const app = Vue.createApp({ data() { - return { goals: [] }; + return { + goals: [], + enteredGoal: '', + }; + }, methods: { addGoal() { diff --git a/03 - lists conditional/lists-cond-01-starting-setup/index.html b/03 - lists conditional/lists-cond-01-starting-setup/index.html index 9cabc50..43fc531 100644 --- a/03 - lists conditional/lists-cond-01-starting-setup/index.html +++ b/03 - lists conditional/lists-cond-01-starting-setup/index.html @@ -18,12 +18,17 @@ </header> <section id="user-goals"> <h2>My course goals</h2> - <input type="text" v-model="enteredGoal"/> + <input type="text" v-model="enteredGoal" /> <button @click="addGoal">Add Goal</button> - <p v-if="goals.length === 0">No goals have been added yet - please start adding some!</p> + <p v-if="goals.length === 0"> + No goals have been added yet - please start adding some! + </p> <ul v-else> - <li>Goal</li> + <li v-for="(goal, i) in goals">{{i}} - {{goal}}</li> </ul> + <!-- <ul> + <li v-for="(value, key) in {nome: 'cristiano', cognome: 'magro'}">{{key}}: {{value}}</li> + </ul> --> </section> </body> </html> -- Gitblit v1.8.0