ESC login

This commit is contained in:
penner 2022-12-21 23:51:25 +00:00
parent 82ebd211f6
commit e53619ebcf

View file

@ -26,7 +26,7 @@
</section> </section>
<footer class="modal-card-foot"> <footer class="modal-card-foot">
<button class="button is-success" @click="submit">Login</button> <button class="button is-success" @click="submit()">Login</button>
<button class="button is-danger" @click="set_active(false)"> <button class="button is-danger" @click="set_active(false)">
Cancel Cancel
</button> </button>
@ -44,6 +44,12 @@ export default class LoginModal extends Vue {
private username = ""; private username = "";
private password = ""; private password = "";
public created(): void {
window.addEventListener("keydown", (e) => {
if (e.key == "Escape") this.set_active(false);
});
}
public set_active(state: boolean): void { public set_active(state: boolean): void {
this.active = state; this.active = state;