Y
Y
Yuri Dmitriev2018-07-20 14:00:33
Vue.js
Yuri Dmitriev, 2018-07-20 14:00:33

Input parameters undefined?

There is a parent component in which I call the child component and pass the parameters.
5b51bf8d3ee81072068257.png
In the 'news-recommendation' component, I output the input parameters to the console, it displays undefined.
5b51c078f078b964283152.png
Vue DevTools has input parameters.
5b51c0bfb129d446663035.png
I can't figure out what's the problem

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
floydback, 2018-07-21
@BonifacyBel

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 question

Ask a Question

731 491 924 answers to any question