The second chapter IX vue.js combat Render function

vue2.x using virtual DOM, it is a lightweight js objects, changes in the state will be diff operation, updates need to be replaced dom, but not all redrawn.

// Create js DOM object with the Virtual 
var vNoe = { 
    Tag: 'div' , 
    Attributes: { 
        ID: 'main' 
    }, 
    Children: [ 
        @ P node 
    ] 
}

In the vue2.x, VDOM is expressed by means of a VNode classes, each element or component corresponds dom a VNode object. Use vdom can take full advantage of js programming capabilities, the majority of the scene using template is sufficient, but in some specific scene, using vdom will be easier.

If you do use webpack compiled, template will be pre-compiled to render function.

 

Guess you like

Origin www.cnblogs.com/fishope/p/10948922.html