Prompt undefined to get the value from the parent component in the child component

parent component
clipboard.png

clipboard.png
useridvuedevtools

clipboard.png
I think it"s a matter of execution order. When called in mounted, prop hasn"t got the data yet.
what should I do in this situation, listening in watch?

Mar.16,2021

need to use watch to listen
watch: {

userid(curInfo, oldInfo) {
  if (curInfo) {
    this.userid= curInfo;
    this.getPerMsg();
  }
}

},


it's OK to watch,. It's just that I don't think I can send personmsg, directly so that the order is not involved.


Thank you for your answers.
I have consulted the relevant materials
1. Life cycle order of parent and child components
https://www.cnblogs.com/statu.
2. The parent component asynchronously requests data to be passed to the child component
http://www.jb51.net/article/1.
finally makes a non-null judgment in the parent component. If it is empty, the child component is not initialized. If the parent component gets the data, then initialize the child component, there will be no problem of the child component getting empty.

Menu