Creating custom nested component - adding children

未关闭
#566 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
react, typescript
领域
frontend

调研方向

先阅读 src/components/ReactComponent.jsx,并跟踪 issue 中描述的自定义 NestedReactComponent 和 attachReact 入口点。检查 this.components 的处理方式;完成的标准是所创建的自定义组件通过 attachReact 渲染其嵌套子元素。

由索引模型根据 Issue 内容生成。

描述

Hi,

I would like to create custom nested component. But not sure how to proceed in this case.

I wanted to go with writing similar class as https://github.com/formio/react/blob/master/src/components/ReactComponent.jsx that wound extend Formio.Components.components.nested.

Something like

import { Formio } from '@formio/js';

const Nested = Formio.Components.components.nested;

export abstract class NestedReactComponent extends Nested {
  ...
    abstract attachReact(element:, ref); 
}

And I would implement all the methods needed as in ReactComponent.

Then I would like to extend this base class for every custom nested component needed. And this is sort of working.
I cannot actually add the (nested) children to the created custom component. I can see that i have this.components in the base class, but I don't how to add them as children to the element overridden attachReact method.

主要语言
TypeScript
星标
371
派生
309
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

formio/react 的其他 Issue

查看 formio/react 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。