Communication between vue Parent and Child Components

  node.js, question

clipboard.png
I am a sub-component in the parent template inside loop. How do I define the variables of the for inside loop to be realized in the sub-component template inside?
Such direct output variables cannot be found in extend inside. Please ask the great god how to deal with this situation.

Look at documentshttps://cn.vuejs.org/guide/co …

Data cannot be passed to the component because the scope of the component is isolated. To pass data to a component, props should be used:

<my-component
 v-for="item in items"
 :item="item"
 :index="$index">
 </my-component>

The reason why item is not automatically injected into the component is that it will cause the component to be tightly coupled with the current v-for. Explicitly declare where the data comes from so that components can be reused elsewhere.