Fixed not updating answer image; Fixed undefined on resetting image non image types

This commit is contained in:
EisiBaer 2023-07-17 22:14:15 +02:00
parent 6a0d83454a
commit c9a5192a80
3 changed files with 21 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<script setup>
import { computed, onMounted, ref } from "vue";
import { computed, onMounted, ref, watch, nextTick } from "vue";
import { useGameCreationStore } from "@/stores/GameCreationStore";
import { useRoute } from "vue-router";
@ -34,7 +34,18 @@ onMounted( () => {
if( imageRef.value ){
imageRef.value.src = API_URL + '/game/file/' + props.answer.filename;
}
})
});
watch(
() => props.bEIndex,
( _newVal, _oldVal ) => {
nextTick( () => {
if( imageRef.value ){
imageRef.value.src = API_URL + '/game/file/' + props.answer.filename;
}
});
}
)
</script>

View File

@ -92,9 +92,13 @@ watch(
watch(
() => props.boardEntryIndex,
( newVal, oldVal ) => {
if( answerImageInput.value ){
answerImageInput.value.value = "";
}
if( questionImageInput.value ){
questionImageInput.value.value = "";
}
}
);
</script>

View File

@ -91,6 +91,8 @@ function stopAudio(){
<div v-show="props.isAnswerRevealed">
<AnswerView
:answer="boardEntry.answer"
:cIndex="props.cIndex"
:bEIndex="props.bEIndex"
/>
</div>