Looking to implement an action only when the user has hovered over a div for at least 1 second. Here's how it's set up:
<div @mouseover="trigger"></div>
In the script section:
data() {
return {
hovered: false
}
}
methods: {
trigger() {
setTimeout(function(){ this.hovered = true }, 1000)
}
}
My issue lies in understanding the scope within Vue. The 'hovered' variable is not recognized within the function, causing errors. Any suggestions on how to resolve this?