S
S
Sergey Khlopov2019-08-26 10:14:05
Vue.js
Sergey Khlopov, 2019-08-26 10:14:05

What is the best way to close a modal window by pressing the esc key?

Hello, please tell me, I have a pop-up block at the bottom of the window (success or error message) and I would like it to be hidden by pressing the esc key and the same with modal windows. There is, of course, an option in my head that when the modal window opens, hang it on the body using the usual addEventListenerkeypress event, and when this event closes, delete it, because. I have not only a modal window, but also success or error messages.
Thank you in advance for your response

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VegasChickiChicki, 2019-08-26
@VegasChickiChicki

If your block displays by parameter from data, then just change the value through:
https://ru.vuejs.org/v2/guide/events#Modifiers-...
ps I didn't know this myself, but I found it in Google in 2 minutes. ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question