Push an array object into another array

Xiaobian encountered a problem during the development process today

 

 

This is a three-level linkage. When I click the confirm button, a request will be sent to the background and the data will be assigned. But when I click to confirm, I get an error Cannot set property'name' of undefined, please see the code picture below

 

 

Error code picture: I think I have defined the name in the data array, why am I still reporting an error? ? ?

I define it like this to fix that there can only be one object in data, and an error will be reported when multiple entries are returned.

 

 

Correct code: To define a new array, then push it in,,,

 Have you stepped on the pit?

Guess you like

Origin blog.csdn.net/qq_40055200/article/details/108865251