0

I have a simple input type text and I want to remove the onKeyPress for performance.

I tested many solution like this by it doesn't work. I see again event press on performance tab in chrome navigator

mounted() {
    const doc = document.getElementById('input-simple-text')
    doc.onkeydown = null
}

// simple input
 <input  class="form-control"
         id="input-simple-text"
         type="text"
         v-model="mutableValue"
         ref="input" />

If you have solutions to delete this events , thanks

Seb
  • 404
  • 2
  • 4
  • 14

1 Answers1

0

According to the documentation, you have quite a lot of possibilities. One of them is to prevent the event or stop its propagation. https://v2.vuejs.org/v2/guide/events.html#Event-Modifiers

<input  class="form-control"
         id="input-simple-text"
         type="text"
         v-model="mutableValue"
         v-on:keyup="$event.preventDefault()"
         ref="input" />
tony19
  • 125,647
  • 18
  • 229
  • 307
Stefan
  • 1,431
  • 2
  • 17
  • 33
  • I tested but if i see the performance of chrome... I have lot of events for 'Event: keypress' – Seb Aug 31 '20 at 17:58