From 948b23dac23898dfb4e340840d6f94458c5dd2ba Mon Sep 17 00:00:00 2001 From: Cristiano Magro <cristiano.magro@vola.it> Date: Thu, 26 Dec 2024 15:08:42 +0100 Subject: [PATCH] remove itme form list --- 03 - lists conditional/lists-cond-01-starting-setup/app.js | 3 +++ 03 - lists conditional/lists-cond-01-starting-setup/index.html | 2 +- 2 files changed, 4 insertions(+), 1 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 8c74258..d3e2128 100644 --- a/03 - lists conditional/lists-cond-01-starting-setup/app.js +++ b/03 - lists conditional/lists-cond-01-starting-setup/app.js @@ -10,6 +10,9 @@ addGoal() { this.goals.push(this.enteredGoal) }, + removeGoal(idx){ + this.goals.splice(idx,1); + }, }, }); 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 43fc531..2793242 100644 --- a/03 - lists conditional/lists-cond-01-starting-setup/index.html +++ b/03 - lists conditional/lists-cond-01-starting-setup/index.html @@ -24,7 +24,7 @@ No goals have been added yet - please start adding some! </p> <ul v-else> - <li v-for="(goal, i) in goals">{{i}} - {{goal}}</li> + <li v-for="(goal, idx) in goals" @click="removeGoal(idx)">{{idx}} - {{goal}}</li> </ul> <!-- <ul> <li v-for="(value, key) in {nome: 'cristiano', cognome: 'magro'}">{{key}}: {{value}}</li> -- Gitblit v1.8.0