finish lesson 46
This commit is contained in:
parent
39e437990c
commit
bf1973a608
|
@ -9,6 +9,9 @@ const app = Vue.createApp({
|
||||||
addGoal() {
|
addGoal() {
|
||||||
this.goals.push(this.enteredGoalValue);
|
this.goals.push(this.enteredGoalValue);
|
||||||
},
|
},
|
||||||
|
removeGoal(index) {
|
||||||
|
this.goals.splice(index, 1);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,10 @@
|
||||||
<button @click="addGoal">Add Goal</button>
|
<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>
|
<ul>
|
||||||
<li v-for="(goal, index) in goals">{{ goal }}</li>
|
<li v-for="(goal, index) in goals" :key="goal" @click="removeGoal(index)">
|
||||||
|
<p>{{ goal }} - {{ index }}</p>
|
||||||
|
<input type="text" @click.stop>
|
||||||
|
</li>
|
||||||
<!-- <li v-for="(value, key, index) in {name: 'Max', age: 32}">{{ value }} - {{ key }} - {{ index }}</li>
|
<!-- <li v-for="(value, key, index) in {name: 'Max', age: 32}">{{ value }} - {{ key }} - {{ index }}</li>
|
||||||
<li v-for="num in 10">{{ num }}</li> -->
|
<li v-for="num in 10">{{ num }}</li> -->
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Reference in New Issue