In this simple Vue 3 app, I would like to pass props to a component and access the values in the script section. I can't because they are undefined.
I can access values in the template section, though the first time it renders, I have a v-if guard because the value is undefined the first time it is rendered.
In this screenshot of the app, you can see the value "Floretta" properly rendered in the template, and the console.log output showing that the value of props.pdata.table is undefined immediately after the defineProps() line. (See the Component.vue code below)
What I've tried:
How can I get access to my data in the script section, for example to set up other parts of the UI, such as computing a list of dates displayed in a table? The dates differ depending on values in the props pdata object.
Here is the stripped down application.
App.vue:
Component.vue:
Here is an example of using a watcher.
<script setup lang="ts">
const props = defineProps({ pdata: Object })
watch(() => props.pdata, () => {
console.log('==>', props.pdata.value)
}, { deep: true })
</script>