Home > front end >  Child components in the parent component traversal, and receives the parent component by props trave
Child components in the parent component traversal, and receives the parent component by props trave

Time:10-04

My first step was to traverse the parent components of data each item of the corresponding value (item) to the child components, child components use props to receive the diagram below:


The second step in the subcomponents approach preach addCar (enclosing the item), and so on a series of methods as shown in figure:


The third step, click on the plus sign in the view, this time will be an error, information is as follows:


Please bosses, some directions the younger brother in this operation there is a problem, the younger brother novice, the first worship was complete bosses

CodePudding user response:

The second step inside the code "this." take out, without this in HTML

CodePudding user response:

Get rid of this also not line, will be submitted to null

CodePudding user response:

Initial guess, should be in the child component method and the ". This item ", but how to solve this problem?

CodePudding user response:

Props: {item: {type: xx, default: xx}}, show the item a default value

CodePudding user response:

I use compued to return to the "item" in the props, solved the problem of the error
  • Related