Answer the question
In order to leave comments, you need to log in
Input parameters undefined?
There is a parent component in which I call the child component and pass the parameters.
In the 'news-recommendation' component, I output the input parameters to the console, it displays undefined.
Vue DevTools has input parameters.
I can't figure out what's the problem
Answer the question
In order to leave comments, you need to log in
Your mistake is that the child component renders and its mounted hook is called before the parent component has finished its axios request. Therefore, the hook is undefined and the data appears in the console.
Alternatively, add a v-if on the child component with the appropriate condition
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question