0👍
✅
Just as Rob Louie spotted in the comment, the ‘s’ was missing from the methods. So the code snippet for that segment becomes
<script>
export default{
name: 'AddTask',
data() {
return {
text: '',
day: '',
reminder: false,
}
},
methods: {
onSubmit(e){
e.preventDefault()
if (!this.text) {
alert('Please add a task')
return
}
const newTask = {
id: Math.floor(Math.random() * 100000),
text: this.text,
day: this.day,
reminder: this.reminder,
}
console.log(newTask)
//this.$emit('add-task', newTask)
this.text = ''
this.day = ''
this.reminder = false
}
}
}
</script>
Source:stackexchange.com