2023-01-24 00:14:50 +00:00
|
|
|
<template>
|
|
|
|
<section>
|
|
|
|
<div class="content">
|
|
|
|
<ul>
|
|
|
|
<li>Linksklick: Türchen auswählen</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<figure class="image">
|
|
|
|
<img src="@/assets/adventskalender.jpg" />
|
|
|
|
<ThouCanvas>
|
2023-01-25 11:39:58 +00:00
|
|
|
<SVGRect
|
2023-02-02 15:29:26 +00:00
|
|
|
v-for="(door, index) in unchosen_doors"
|
|
|
|
:key="`door-${index}`"
|
|
|
|
:rectangle="door.position"
|
|
|
|
@click.left="choose_door(index)"
|
2023-01-25 09:56:05 +00:00
|
|
|
style="cursor: pointer"
|
2023-01-24 00:14:50 +00:00
|
|
|
/>
|
2023-01-24 11:35:45 +00:00
|
|
|
<template
|
2023-02-02 15:29:26 +00:00
|
|
|
v-for="(door, index) in chosen_doors"
|
|
|
|
:key="`door_chosen-${index}`"
|
2023-01-24 11:35:45 +00:00
|
|
|
>
|
2023-02-02 15:29:26 +00:00
|
|
|
<SVGRect :rectangle="door.position" :focused="true" />
|
|
|
|
<SVGRectText :rectangle="door.position" :text="String(door.day)" />
|
2023-01-24 11:35:45 +00:00
|
|
|
</template>
|
2023-01-24 00:14:50 +00:00
|
|
|
</ThouCanvas>
|
|
|
|
</figure>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { Options, Vue } from "vue-class-component";
|
2023-02-02 15:29:26 +00:00
|
|
|
import { Door } from "./calendar";
|
2023-01-24 00:14:50 +00:00
|
|
|
|
|
|
|
import ThouCanvas from "../rects/ThouCanvas.vue";
|
2023-01-25 11:39:58 +00:00
|
|
|
import SVGRect from "../rects/SVGRect.vue";
|
|
|
|
import SVGRectText from "../rects/SVGRectText.vue";
|
2023-01-24 00:14:50 +00:00
|
|
|
|
|
|
|
@Options({
|
|
|
|
components: {
|
|
|
|
ThouCanvas,
|
2023-01-25 11:39:58 +00:00
|
|
|
SVGRect,
|
|
|
|
SVGRectText,
|
2023-01-24 00:14:50 +00:00
|
|
|
},
|
|
|
|
props: {
|
2023-02-02 15:29:26 +00:00
|
|
|
doors: Array,
|
2023-01-24 00:14:50 +00:00
|
|
|
},
|
2023-02-02 15:29:26 +00:00
|
|
|
emits: ["update:doors"],
|
2023-01-24 00:14:50 +00:00
|
|
|
})
|
2023-01-24 23:19:25 +00:00
|
|
|
export default class extends Vue {
|
2023-02-02 15:29:26 +00:00
|
|
|
private doors!: Door[];
|
|
|
|
private day = 0;
|
2023-01-24 00:14:50 +00:00
|
|
|
|
2023-02-02 15:29:26 +00:00
|
|
|
private get chosen_doors(): Door[] {
|
|
|
|
return this.doors.filter((door) => door.day !== undefined);
|
|
|
|
}
|
|
|
|
|
|
|
|
private get unchosen_doors(): Door[] {
|
|
|
|
return this.doors.filter((door) => door.day === undefined);
|
|
|
|
}
|
|
|
|
|
|
|
|
private choose_door(index: number) {
|
|
|
|
this.unchosen_doors[index].day = this.day;
|
|
|
|
this.day++;
|
2023-01-24 00:14:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public beforeUnmount() {
|
2023-02-02 15:29:26 +00:00
|
|
|
this.$emit("update:doors", this.doors);
|
2023-01-24 00:14:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
section > figure {
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
</style>
|