Skip to content

dumi自动生成文档api的tips #7

@ImJustAMan

Description

@ImJustAMan

dumi提供的自动生成文档API暂时有一些小bug
如果需要某个组件本身需要多API 需要考虑下述方法进行使用

  1. 在PropsType.ts或者新建一个ts/tsx文件 在文件当中export方法
  • 例如 List组件当中需要使用List与ListItem两个组件 我需要在文档中同时显示两个组件对应API
  • 在PropsType.ts中export两个方法分别叫做List和ListItem
  • 对两个方法进行传参并且参数设置对应类型,如: export function List(list: IListPropsType) {}
  1. 在对应md文件当中使用<API src="对应存放导出方法的文件" exports='放置导出数组'></API>
  • src中传入的就是上述内容存放两个方法的文件,List中就是./PropsType.ts
  • exports传入一个数组 该数组要保证JSON格式
  • exports中传入的数组对应在PropsType.ts中导出的多个方法 需要导出几个方法就写上对应方法名即可

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionDiscuss idea or feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions