I am encountering an issue with two Vue components, EventTask
and EventCard
. Within EventTask
, there is a currentEvent
object in the data
section, which I pass as a prop to EventCard
using the following code snippet:
<event-card :current-event="currentEvent" />
Within the EventCard
component, I attempt to initialize an event
data property based on the currentEvent
prop. I followed advice from this answer.
export default {
name: 'EventCard',
props: {
currentEvent: {
type: Object,
required: false
}
},
data: function () {
return {
event: { ...this.currentEvent }
}
}
}
Despite my efforts, I am facing an issue where the event
data property fails to be set accurately. The Vue developer tools display an unexpected outcome as shown below:
https://i.sstatic.net/RvCgR.png
The event
data property appears empty while the currentEvent
prop contains multiple properties. Why is the initialization of the data property not aligning correctly with the prop?