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

View File

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

View File

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