mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
readability
This commit is contained in:
parent
08972df4cc
commit
2ae4fb8695
1 changed files with 13 additions and 10 deletions
|
@ -5,11 +5,7 @@
|
||||||
<div class="modal-card">
|
<div class="modal-card">
|
||||||
<header class="modal-card-head">
|
<header class="modal-card-head">
|
||||||
<p class="modal-card-title">Login</p>
|
<p class="modal-card-title">Login</p>
|
||||||
<button
|
<button class="delete" @click.left="cancel" />
|
||||||
class="delete"
|
|
||||||
aria-label="close"
|
|
||||||
@click.left="$emit('cancel')"
|
|
||||||
/>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
|
@ -36,13 +32,13 @@
|
||||||
<footer class="modal-card-foot is-flex is-justify-content-space-around">
|
<footer class="modal-card-foot is-flex is-justify-content-space-around">
|
||||||
<BulmaButton
|
<BulmaButton
|
||||||
class="button is-success"
|
class="button is-success"
|
||||||
@click.left="$emit('submit', username, password)"
|
@click.left="submit"
|
||||||
icon="fa-solid fa-unlock"
|
icon="fa-solid fa-unlock"
|
||||||
text="Login"
|
text="Login"
|
||||||
/>
|
/>
|
||||||
<BulmaButton
|
<BulmaButton
|
||||||
class="button is-danger"
|
class="button is-danger"
|
||||||
@click.left="$emit('cancel')"
|
@click.left="cancel"
|
||||||
icon="fa-solid fa-circle-xmark"
|
icon="fa-solid fa-circle-xmark"
|
||||||
text="Abbrechen"
|
text="Abbrechen"
|
||||||
/>
|
/>
|
||||||
|
@ -74,9 +70,8 @@ export default class extends Vue {
|
||||||
};
|
};
|
||||||
|
|
||||||
private on_keydown(e: KeyboardEvent) {
|
private on_keydown(e: KeyboardEvent) {
|
||||||
if (e.key == "Escape") this.$emit("cancel");
|
if (e.key == "Enter") this.submit();
|
||||||
else if (e.key == "Enter")
|
else if (e.key == "Escape") this.cancel();
|
||||||
this.$emit("submit", this.username, this.password);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public mounted(): void {
|
public mounted(): void {
|
||||||
|
@ -92,5 +87,13 @@ export default class extends Vue {
|
||||||
public beforeUnmount(): void {
|
public beforeUnmount(): void {
|
||||||
window.removeEventListener("keydown", this.on_keydown);
|
window.removeEventListener("keydown", this.on_keydown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public submit(): void {
|
||||||
|
this.$emit("submit", this.username, this.password);
|
||||||
|
}
|
||||||
|
|
||||||
|
public cancel(): void {
|
||||||
|
this.$emit("cancel");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue