Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VueJS: remove listener setup in view

Tags:

vue.js

My code:

<input type="text" v-on:keydown="handler">

How can I manually destroy this listener ? I can do this:

handler: function(){
  return;
}

But I want to completely remove listener itself. Thanks

like image 384
Fyodor Khruschov Avatar asked Dec 25 '22 08:12

Fyodor Khruschov


1 Answers

Is $off() what you are looking for?

Remove event listener(s).

  • If no arguments are provided, remove all event listeners;

  • If only the event is provided, remove all listeners for that event;

http://vuejs.org/api/#vm-off

like image 141
Jeff Avatar answered Dec 26 '22 21:12

Jeff