The vue parent component updates data asynchronously, and the child component props cannot receive the value passed by the parent component? -----------Solution

I encountered a similar problem when I was working on a project today, and I solved it later. I will share it with you today, I hope it can help everyone, thank you! ! !
insert image description here
A variable is defined as empty . When the
insert image description here
child component is mounted and executed, axios has no return value, so the mounted will only be executed once, resulting in the child component not receiving the value passed by the parent component.
Problem explanation: When the parent component axjos obtains data and the child component uses props to receive data, axjos has not returned data when mounted is executed, and mounted is only executed once, and the data received in props is empty.
Solution: Determine the length of the data in the corresponding place of the parent component.
insert image description here

Guess you like

Origin blog.csdn.net/weixin_44237840/article/details/116149618