The problem of variable reference in vue2

question 1: I call the method of init in beforeCreate () to assign a value to uivalue. Uivalue is used in vMub model, and a strange problem is found:

   
     console.log(this);
     console.log(this.uiValue);
     console.log(uiValue);
     uiValue= {...dispatchOptionVO}
     
  :   VueComponent{uiValue:xxx}
                    undefined
                    undefined .

Why the value of uiValue can be seen in the first this, but not in the second this.uiValue.

Mar.24,2021

this is because the value of the object printed on the console is not only the current value, the subsequent changes will also affect its results


print this is a vue object, of course there is a value. While uiValue is not defined, of course undefined;


console this object is implemented by the host environment ~ if you use console.log (this.uiValue) in multiple browsers, you will also find different display results ~

.
Menu