I am using Laravel Spark, and have a component within a component.
<parent-component :user="user">
<child-component :user="user" :questions="questions"></child-component>
<parent-component>
In my parent component I have questions data in my data method:
props: ['user'],
data(){
return {
questions: {
// these are set in another method in this file
},
}
},
As you can see, I have added :questions to my child component in the hope of being able to use the questions in that component as I need to loop through them.
In my js file for the child component I have:
props: ['user', 'questions'],
But when trying to use the questions I get a default object unlike the user which contains all the information.
How should this be done correctly as im just guessing currently...
Here is the js file for the child component:
Vue.component('control-question-navigation', {
props: ['user', 'questions'],
data() {
return {
//
}
},
methods: {
},
mounted() {
var $this = this;
console.log($this.questions); // return standard object
console.log($this.user); // returns the user data correctly
}
});