代码之家  ›  专栏  ›  技术社区  ›  unom

海滨-当在“renderContentOn:html”中直接调用“html render:”时,在WAComponent中实现#children有什么意义?

  •  2
  • unom  · 技术社区  · 10 年前
    Whatever >> children
            ^Array with: oneComponent with: anotherComponent.
    

    在稍后的代码中,可能会有这样的内容。

    Whatever >> renderContentOn: html
            ...
            html render: oneComponent.
            ...
            html render: anotherComponent.
    

    既然我显式调用来渲染这些组件,那么在#children中使用它们有什么用?#儿童是否用于其他用途?

    1 回复  |  直到 10 年前
        1
  •  5
  •   Lukas Renggli    10 年前

    海边取决于 #children 正确实现以下回调:

    • #updateRoot: 为了定制所生成的HTML文档的头部,
    • #initialRequest: 为了在会话开始时初始化组件,
    • #updateUrl: 为了修改当前URL,
    • #updateStates: 以登记用于回溯的对象,
    • 以及支持助手方法,如 #states , #scripts #styles .

    搜索 Seaside Book 了解更多关于这些方法的信息。