BuilderIO/mitosis

core: add new fields to MitosisComponent type: slots

Open

#325 创建于 2022年5月8日

在 GitHub 查看
 (10 评论) (0 反应) (0 负责人)TypeScript (411 fork)batch import
coreenhancementhelp wanted

仓库指标

Star
 (9,803 star)
PR 合并指标
 (平均合并 1天 1小时) (30 天内合并 6 个 PR)

描述

export const createMitosisComponent = (
  options?: Partial<MitosisComponent>,
): MitosisComponent => ({
  '@type': '@builder.io/mitosis/component',
  imports: [],
  inputs: [],
  meta: {},
  state: {},
  children: [],
  hooks: {},
  context: { get: {}, set: {} },
  name: options?.name || 'MyComponent',
  subComponents: [],
  ...options,
});

a component needs to have all named slots available and I think it should be added here. and inside of children we need Slot nodes

'@type': '@builder.io/mitosis/component',
  slots: {
    mySelectorName: createMitosisComponent({})
  },
  children: [
    createMitosisNode({
      name: 'Slot',
      properties: {
        name: 'mySelectorName'
      } 
    });
  ],

贡献者指南