I added a event listener to my document like this:
deleteTask(event){
// myFunc
}
created() {
document.addEventListener("keypress", this.deleteTask);
},
This happened in my Home.vue component. Now i want to remove this event listener in my Card.vue component. Like so:
document.removeEventListener("keypress", this.deleteTask);
This obviously doesn't work since this.deleteTask is not known in the Card.vue component. But i need the deleteTask func to stay in my Home.vue cause it operates on some arrays there. So my question is now: What is the best way to do this?