bug: drop v-model for mutable objects

This commit is contained in:
Jörn-Michael Miehe 2023-09-21 13:29:47 +00:00
parent 5fcc4f0684
commit de5fff311c
4 changed files with 4 additions and 19 deletions

View file

@ -37,8 +37,8 @@
</div> </div>
</div> </div>
<DoorPlacer v-if="current_step === 0" v-model:doors="doors" /> <DoorPlacer v-if="current_step === 0" :doors="doors" />
<DoorChooser v-if="current_step === 1" v-model:doors="doors" /> <DoorChooser v-if="current_step === 1" :doors="doors" />
<div v-if="current_step === 2" class="card-content"> <div v-if="current_step === 2" class="card-content">
<Calendar :doors="doors" /> <Calendar :doors="doors" />
</div> </div>

View file

@ -14,9 +14,9 @@
<img :src="$advent22.api_url('user/background_image')" /> <img :src="$advent22.api_url('user/background_image')" />
<ThouCanvas> <ThouCanvas>
<PreviewDoor <PreviewDoor
v-for="(_, index) in doors" v-for="(door, index) in doors"
:key="`door-${index}`" :key="`door-${index}`"
v-model:door="doors[index]" :door="door"
/> />
</ThouCanvas> </ThouCanvas>
</figure> </figure>
@ -38,13 +38,8 @@ import PreviewDoor from "./PreviewDoor.vue";
props: { props: {
doors: Array, doors: Array,
}, },
emits: ["update:doors"],
}) })
export default class extends Vue { export default class extends Vue {
public doors!: Door[]; public doors!: Door[];
public beforeUnmount() {
this.$emit("update:doors", this.doors);
}
} }
</script> </script>

View file

@ -34,7 +34,6 @@ import RectangleCanvas from "./RectangleCanvas.vue";
props: { props: {
doors: Array, doors: Array,
}, },
emits: ["update:doors"],
}) })
export default class extends Vue { export default class extends Vue {
private doors!: Door[]; private doors!: Door[];
@ -70,9 +69,5 @@ export default class extends Vue {
this.doors.splice(idx, 1); this.doors.splice(idx, 1);
} }
public beforeUnmount() {
this.$emit("update:doors", this.doors);
}
} }
</script> </script>

View file

@ -45,7 +45,6 @@ import SVGRect from "../calendar/SVGRect.vue";
props: { props: {
door: Door, door: Door,
}, },
emits: ["update:door"],
}) })
export default class extends Vue { export default class extends Vue {
public door!: Door; public door!: Door;
@ -130,10 +129,6 @@ export default class extends Vue {
this.toggle_editing(); this.toggle_editing();
} }
} }
public beforeUnmount() {
this.$emit("update:door", this.door);
}
} }
</script> </script>