In vue render: => h (App) is explained in detail h

 

render: h => h(App) Is an acronym for the following content:

  1.  
    render: function (createElement) {
  2.  
    return createElement(App);
  3.  
    }

Further abbreviated as (ES6 grammar):

  1.  
    render (createElement) {
  2.  
    return createElement(App);
  3.  
    }

Further abbreviated as:

  1.  
    render ( h){
  2.  
    return h(App);
  3.  
    }

According to the wording of the arrow ES6 function, we get:

render: h => h(App);

Even You Vue.js according to which the author's reply , h the following meanings:

It comes from the term "hyperscript", which is commonly used in many virtual-dom implementations. "Hyperscript" itself stands for "script that generates HTML structures" because HTML is the acronym for "hyper-text markup language".

It comes from the word  hyperscript, the word is often used in the realization of virtual-dom. Hyperscript It refers to itself 
生成HTML 结构的 script 脚本, because HTML is  hyper-text markup language the acronym (HTML)

Personal understanding: createElement function is used to generate HTML DOM elements, i.e. the above generate HTML structures, i.e. Hyperscript, so that only then createElement OF abbreviated h.

Vue.js inside createElement function, this effect is to generate a function VNode node, then obtain the VNode render function node, the function returns to the mount Vue.js, the rendered real DOM node, and the root mount.

Guess you like

Origin www.cnblogs.com/huge1122/p/11272032.html