seantrant
4/3/2018 - 9:02 AM

Create and destroy key listener

Create and destroy key listener

  mounted() {
    window.addEventListener('keydown', this.onkey)
  },
  destroyed() {
    window.removeEventListener('keydown', this.onkey)
  }



  
  function onkey(event){
    console.log(event)
  }