search

Home  >  Q&A  >  body text

The 'KeyboardEvent.keyCode' modifier 'v-on' directive is deprecated. Use "KeyboardEvent.key" instead of view

I am migrating my application vue 2 to vue 3. I'm getting some deprecation errors when running the application.

In my keyboard event modifier, I use numbers and keys for keyboard events. However, this concept is deprecated, so I'm getting errors. I don't know how to use it now?

Previously

@keyup.ctrl.86="onUpdateEvent()"

I'm getting an error due to the use of numbers. How to solve these problems?

P粉348088995P粉348088995253 days ago308

reply all(1)I'll reply

  • P粉662089521

    P粉6620895212024-03-20 11:00:56

    You can find this in the documentation: https://v3-migration.vuejs.org/writing-changes/keycode-modifiers.html#_3-x-syntax

    It looks like you should use the dash naming for the key rather than the numeric keycode, so in this case you would use @keyup.ctrl.v.

    reply
    0
  • Cancelreply