Home > front end >  Vue theory knowledge summary (a)
Vue theory knowledge summary (a)

Time:10-16

At the heart of the VUE is: data driven component development
The React of nuclear: modular development JSX
Virtual DOM tree: greatly narrow the scope of the DOM element to monitor
What is that contains only nodes may change and may change the properties of the tree structure
Why: less content, facilitate rapid traverse can not find, virtual DOM tree in order to solve the problem of browser performance was designed.
How to happen: when the data model in the variable changes, will inform virtual DOM tree, virtual DOM to cache the modification on the element object again, will be a batch of modify the generated new virtual DOM DOM tree and the tree to do contrast, once discover different elements or content, only update has modified, the elements of virtual DOM in the book, encapsulates the traditional DOMAPI avoids a large number of repetitive code,
VUE life cycle: four phase eight hook function
Before and after the create
BeforeCreate
Created
Create data object encapsulates the inside of the object properties, ajax requests can be
Before and after loading
BeforeMount
Mounted
After loading virtual DOM, can operate the DOM, not the first phase of the first two stages in the component and load time, automatically after two stages can hand
Before and after the update
BeforeUpdate
The updated
Before and after the destruction of
BeforeDestroy
Destroyed
Vue - the router routing implementation
Routing is used to interact with the backend server a way, through different paths, to request different resource
Why the data in the component must be function: because JS characteristics of itself, if the data is an object, then by the object itself is a reference type will affect all the VUE instance data, if the data as a function returns an object, each component instance will not influence each other between
The difference between the computed and the methods
We can be scheduled for the same function as a method or a computational attributes, for the final result, two ways of same
Difference:
Computed: calculation properties are based on their dependent cache, only in the it related changes, inside the attribute value is calculated with the change of
For method, as long as to render, method will always perform this function called
The key role in VUE:
, first of all, the key is used to optimize the key special properties used mainly in the VUE virtual DOM algorithm, a kind of dynamic elements and minimize as much as possible to repair/recycled elements of the same type algorithm, with the same parent child element must have a unique key, repeat the key causes rendering errors,

CodePudding user response:

Studied the
  • Related