readability

This commit is contained in:
Jörn-Michael Miehe 2023-09-11 23:41:45 +00:00
parent 08972df4cc
commit 2ae4fb8695

View file

@ -5,11 +5,7 @@
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Login</p>
<button
class="delete"
aria-label="close"
@click.left="$emit('cancel')"
/>
<button class="delete" @click.left="cancel" />
</header>
<section class="modal-card-body">
@ -36,13 +32,13 @@
<footer class="modal-card-foot is-flex is-justify-content-space-around">
<BulmaButton
class="button is-success"
@click.left="$emit('submit', username, password)"
@click.left="submit"
icon="fa-solid fa-unlock"
text="Login"
/>
<BulmaButton
class="button is-danger"
@click.left="$emit('cancel')"
@click.left="cancel"
icon="fa-solid fa-circle-xmark"
text="Abbrechen"
/>
@ -74,9 +70,8 @@ export default class extends Vue {
};
private on_keydown(e: KeyboardEvent) {
if (e.key == "Escape") this.$emit("cancel");
else if (e.key == "Enter")
this.$emit("submit", this.username, this.password);
if (e.key == "Enter") this.submit();
else if (e.key == "Escape") this.cancel();
}
public mounted(): void {
@ -92,5 +87,13 @@ export default class extends Vue {
public beforeUnmount(): void {
window.removeEventListener("keydown", this.on_keydown);
}
public submit(): void {
this.$emit("submit", this.username, this.password);
}
public cancel(): void {
this.$emit("cancel");
}
}
</script>