Vue lifecycle: why $el outputs this (vue instance objects for undefined, before beforeMount), but $el has a value.

for example, in the beforeCreated hook:

   


I have encountered related problems before. Let me share with you related problems

.

the value of $el has changed when you use your browser to view the contents of this. You can use

.
console.log(JSON.stringify(this));

take a look at the value of $el inside.


https://stackoverflow.com/que.


look at the picture


because what is output in this is a reference to the object, which is later changed

Menu