zoukankan      html  css  js  c++  java
  • render

    为了方便仍然有疑惑的人,贴一个链接, 其中 @bjunc 的解答可以作为该题的完美回答;

    大概的翻译下:
    render: h => h(App) 是下面内容的缩写:

    render: function (createElement) {
        return createElement(App);
    }

    进一步缩写为(ES6 语法):

    render (createElement) {
        return createElement(App);
    }

    再进一步缩写为:

    render (h){
        return h(App);
    }

    按照 ES6 箭头函数的写法,就得到了:

    render: h => h(App);

    其中 根据 Vue.js 作者 Even You 的回复,h 的含义如下:

    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".

    它来自单词 hyperscript,这个单词通常用在 virtual-dom 的实现中。Hyperscript 本身是指
    生成HTML 结构的 script 脚本,因为 HTML 是 hyper-text markup language 的缩写(超文本标记语言)

    个人理解:createElement 函数是用来生成 HTML DOM 元素的,也就是上文中的 generate HTML structures,也就是 Hyperscript,这样作者才把 createElement 简写成 h。

  • 相关阅读:
    tab选项卡
    为什么不高兴呢
    #pragma INITCODE 是什么意思
    驱动开发基础知识
    Windows的驱动开发模型
    分页内存和非分页内存区别
    WDF驱动模型
    博客启动描述
    struct和typedef struct
    数据解析代码
  • 原文地址:https://www.cnblogs.com/flintlovesam/p/15027602.html
Copyright © 2011-2022 走看看