Skip to content

Commit

Permalink
VImage watcher for changes in prop when episode switches to different…
Browse files Browse the repository at this point in the history
… sources
  • Loading branch information
bonomite committed Apr 18, 2024
1 parent 54b2a6a commit 9f2d847
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion v2/src/components/VImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@ import VImageNpr from "./VImageNpr.vue"
import VImagePublisher from "./VImagePublisher.vue"
import VImageWagtail from "./VImageWagtail.vue"
import { cmsSources, getCmsSource } from "./helpers.js"
import { ref, watch } from "vue"
const props = defineProps({
src: {
default: null,
type: String,
},
})
const cmsSource = ref(getCmsSource(props.src))
const cmsSource = getCmsSource(props.src)
// Watch the 'src' prop for changes and update 'cmsSource' accordingly
watch(
() => props.src,
(newSrc) => {
cmsSource.value = getCmsSource(newSrc)
}
)
</script>

<template>
Expand Down

0 comments on commit 9f2d847

Please sign in to comment.