Vue life cycle


Vue life cycle

  • The events from the creation of vues are collectively referred to as lifecycles
  • Lifecycle hook, which is the alias of an event
  • Main life cycle function classification:
  • Life function during creation
    • Beforecreate: the first life cycle function is called at a time after new. At this time, the method in the function cannot be called
    • Create: the second life cycle function has been created by this time. You can use the data and methods in it
    • Before mount: the third lifecycle function indicates that the template has been edited in memory, and the elements in the page have not been replaced when the function is executed. Just some template strings.
    • Mounted: in the fourth life cycle function, page elements have been replaced by templates in memory. That is, the instance has been initialized and is out of the creation phase.
  • Life function during operation
    • BeforeUpdate: at the first time, it will only be triggered when the data changes. The trigger times are 0 to more than once. The memory data has been updated but the page has not been updated.
    • Update: second, the data update page has also been updated.
  • Life cycle function of destruction phase
    • Before destroy: the first time indicates that the instance has passed from the running stage to the destroying stage. The methods and instructions in the instance can still be used.
  • Destroyed: when the second function is executed, all methods and instructions have been destroyed and cannot be used

Recommended Today

Cat and type

The cat command in Linux corresponds to the type command in window read output.txt Document: Under Linux: cat output.txt Under window: type output.txt Cat is a text output command of Linux. Cat has three functions 1. Display file$ cat output.txt 2. Create folder from keyboard$ cat > filenameOnly new files can be created. Existing files […]