Combining work experience to understand the various life cycles and pitfalls of vue

Not necessarily accurate, just for personal records!

mounted
Mount completed: mount the compiled template to the page (virtual DOM mount), where asynchronous requests and access to DOM nodes can be performed, and $ref operations can be used in vue.

        Step on the pit point : the order of created and mounted before execution is: only after mounted and after can you use methods such as getElementById to obtain dom elements, and dom cannot be used when created, but ! When the two are executed, it is different. For example, I encountered a problem. When the data of the page is obtained asynchronously in created, then I cannot get the elements in mounted. I can only get them after the elements are loaded, so I can also get elements in created at this time.

Guess you like

Origin blog.csdn.net/gjylalaland/article/details/129427042