Answer the question
In order to leave comments, you need to log in
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 addEventListener
keypress 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
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 questionAsk a Question
731 491 924 answers to any question