mstdmstd
mstdmstd

Reputation: 626

How to close the dialog by clicking cancel key?

In my laravel 5.6/vue.js 2.5.7 / vuetify": "^1.0.8" application I use dialogs as written here https://vuetifyjs.com/en/components/dialogs

I wonder if there is a way to close the dialog by clicking cancel key?

MODIFIED : As that is vuetify, my dialog definition looks like :

<v-footer app>
    <v-dialog scrollable v-model="new_registered_users_dialog_visible"  @keyup.esc="new_registered_users_dialog_visible=false">
        <v-card>

and inserting keyup event as above has no effect

I tried to insert alert code in event:

<v-footer app>
    <v-dialog scrollable v-model="new_registered_users_dialog_visible"  @keyup.esc="alert(-1);new_registered_users_dialog_visible=false">
        <v-card>

also no alerts

Which is the right way ?

Thanks!

Upvotes: 0

Views: 705

Answers (1)

Swati Anand
Swati Anand

Reputation: 899

I hope this should work for you:

<v-dialog @keydown.esc="new_registered_users_dialog_visible = false">

You can check this link here that discusses the same use case as yours.

Upvotes: 2

Related Questions