I am working on developing a todo-list application and here is the code I have so far: HTML:
<div class="divPadder">
<input ref="makePlaceholderEmpty" class="inputBoxSize" type="text" :placeholder="placeholder"v-model="task">
<ul>
<li v-for="(item,index) in this.tasks" :key="index">{{item}}</li>
</ul>
</div>
<button class="button" v-on:click="pushAndMakePCEmpty">Submit</button>
Script:
data() {
return {
placeholder:"Please enter your notes here :)",
task: "",
tasks: []
};
},
methods: {
pushAndMakePCEmpty() {
this.$refs.makePlaceholderEmpty.value = "";
this.tasks.push(this.task);
}
}
I am facing an issue where the value does not get updated to an empty string when I include the v-for part in my HTML code. However, if I comment out the v-for part, the value attribute gets updated as expected. I hope someone can help me identify and resolve this problem.