Skip to content

Api agent.md 规范#9492

Merged
chenshuai2144 merged 1 commit intomasterfrom
cursor/api-agent-md-3abb
Feb 20, 2026
Merged

Api agent.md 规范#9492
chenshuai2144 merged 1 commit intomasterfrom
cursor/api-agent-md-3abb

Conversation

@chenshuai2144
Copy link
Contributor

@chenshuai2144 chenshuai2144 commented Feb 20, 2026

优化 API 文档以符合 AGENTS.md 规范,并修复 scripts/readApi.mjs 中的导入错误。


Open in Web Open in Cursor 

Summary by CodeRabbit

  • 文档
    • 为 ProLayout 和 ProTable 组件的 API 文档添加了版本信息列。本次更新在多个组件部分的参数表和配置文档中添加了版本标记,帮助开发者快速了解和查看不同参数、属性和配置选项的版本兼容性信息。

- 修复 readApi.mjs 中重复/错误的 vitest 导入
- ProTable: 添加版本列,按字母顺序排列,规范默认值格式
- ProLayout: 添加版本列,修复 SettingDrawer 表格错位
- menu/ListToolBar/Setting: 统一 API 表格格式
- 字符串默认值使用反引号,布尔/数字类型规范书写

Co-authored-by: 陈帅 <wasd2144@hotmail.com>
@cursor
Copy link

cursor bot commented Feb 20, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

总体概述

本次变更涉及导入语句重组和文档表格更新。在 readApi.mjs 中将连接的导入语句拆分为单独的行,并在 layout.md 和 table.md 中为多个 API 文档表格新增"版本"列,保持现有功能不变。

变更明细

集合 / 文件 变更摘要
导入语句重组
scripts/readApi.mjs
将连接的导入语句拆分为独立的格式化导入行,涉及 fs、glob、path、remark 等模块。仅调整导入语法结构,控制流和错误处理保持不变。
布局文档更新
site/components/layout.md
在 ProLayout 文档的多个 API 表格中新增"版本"列。保持现有的参数、说明、类型、默认值列,在表尾追加版本列,行值默认填充为"-"。
表格文档更新
site/components/table.md
为 ProTable 公共 API 文档的多个章节(如属性、RecordCreator、ColumnStateType、搜索表单、ListToolBar 等)新增"版本"列。对类型注解和默认值进行格式化调整,以适配版本列的添加。

预估代码审查工作量

🎯 2 (Simple) | ⏱️ ~12 分钟

诗歌

🐰 导入排成整齐行,
版本列中添光芒。
文档焕新显风采,
条理分明又敞亮。
小小调整大魅力! ✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cursor/api-agent-md-3abb

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @chenshuai2144, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求主要致力于优化项目的 API 文档,使其符合 AGENTS.md 规范,并通过引入 '版本' 列和重新排序参数来提升文档的清晰度和一致性。此外,还修正了一个在 scripts/readApi.mjs 中存在的导入错误,确保了脚本的正常运行。

Highlights

  • 脚本修复: 修复了 scripts/readApi.mjs 文件中重复的 vitest 导入语句,使导入声明更加规范和清晰。
  • API 文档优化: 更新了 site/components/layout.mdsite/components/table.md 中的 API 参数表格,增加了 '版本' 列,并对参数顺序进行了重新排序,以提高文档的规范性和可读性。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • scripts/readApi.mjs
    • 修复了文件中重复的 vitest 导入声明。
  • site/components/layout.md
    • 在 API 参数表格中新增了 '版本' 列。
    • 重新排序了 menuSettingDrawer 部分的参数,以提高可读性。
  • site/components/table.md
    • ProTableRecordCreatorColumnStateTypeSearchListToolBarPropsSettingListToolBarMenuListToolBarTabsTableDropdown 等多个 API 参数表格中新增了 '版本' 列。
    • ProTableRecordCreatorColumnStateTypeSearchListToolBarPropsSettingListToolBarMenuListToolBarTabsTableDropdown 部分的参数进行了重新排序,以优化文档结构。
Activity
  • 目前没有人工活动记录。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@chenshuai2144 chenshuai2144 marked this pull request as ready for review February 20, 2026 16:48
Copilot AI review requested due to automatic review settings February 20, 2026 16:48
@chenshuai2144 chenshuai2144 merged commit ec1e133 into master Feb 20, 2026
7 of 12 checks passed
@chenshuai2144 chenshuai2144 deleted the cursor/api-agent-md-3abb branch February 20, 2026 16:48
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes API documentation to conform to the AGENTS.md specification and fixes import errors in the scripts/readApi.mjs file. The documentation changes add a "版本" (Version) column to API tables and reorganize properties in alphabetical order as required by the project's documentation standards.

Changes:

  • Fixed corrupted import statements in scripts/readApi.mjs that had test framework imports incorrectly appended to each line
  • Added "版本" (Version) column to all API documentation tables
  • Reorganized API properties in alphabetical order across documentation files

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 10 comments.

File Description
scripts/readApi.mjs Fixed import statements by removing duplicated vitest test imports that were incorrectly appended to each line
site/components/table.md Added Version column, sorted properties alphabetically, improved type formatting consistency
site/components/layout.md Added Version column, sorted properties alphabetically for ProLayout, menu, and SettingDrawer sections

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

| collapseRender | 收起按钮的 render | `(collapsed: boolean, showCollapseButton?: boolean) => ReactNode \| false` | - | - |
| collapsed | 是否收起 | `boolean` | - | - |
| defaultCollapsed | 默认是否收起 | `boolean` | true | - |
| filterType | 过滤表单类型 | `'query' \| 'light'` | `'query'` | - |
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value formatting is inconsistent with the AGENTS.md specification. According to the spec (line 185), string type default values should be wrapped in backticks. The value 'query' should be formatted as `'query'` to follow the standard convention.

Copilot uses AI. Check for mistakes.
| cardBordered | Table 和 Search 外围 Card 组件的边框 | `boolean \| {search?: boolean, table?: boolean}` | false | - |
| cardProps | table 外面卡片的设置 | `ProCardProps \| false` | - | - |
| columns | 列配置能力,支持一个数组 | `ProColumns<T, ValueType>[]` | - | - |
| columnEmptyText | 空值时的显示,不设置时显示 `-`,false 可以关闭此功能 | `ProFieldEmptyText` | `'-'` | - |
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value format is inconsistent with the AGENTS.md specification. According to the spec (line 185), string type default values should be wrapped in backticks. The value '-' should be formatted as `'-'` or `-` to follow the standard convention for string defaults.

Suggested change
| columnEmptyText | 空值时的显示,不设置时显示 `-`,false 可以关闭此功能 | `ProFieldEmptyText` | `'-'` | - |
| columnEmptyText | 空值时的显示,不设置时显示 `-`,false 可以关闭此功能 | `ProFieldEmptyText` | `-` | - |

Copilot uses AI. Check for mistakes.
| filterType | 过滤表单类型 | `'query' \| 'light'` | `'query'` | - |
| labelWidth | 标签的宽度 | `'number' \| 'auto'` | 80 | - |
| onCollapse | 收起按钮的事件 | `(collapsed: boolean) => void` | - | - |
| optionRender | 自定义操作栏 | `(searchConfig, formProps, dom) => ReactNode[] \| false` | - | - |
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value formatting is inconsistent. String type default values should be wrapped in backticks according to AGENTS.md line 185. Change '重置' to `'重置'` or `重置` for consistency.

Suggested change
| optionRender | 自定义操作栏 | `(searchConfig, formProps, dom) => ReactNode[] \| false` | - | - |
| optionRender | 自定义操作栏 | `(searchConfig, formProps, dom) => ReactNode[] \| false` | - | - |

Copilot uses AI. Check for mistakes.
| searchText | 查询按钮的文本 | `string` | `'查询'` | - |
| showHiddenNum | 是否显示收起之后显示隐藏个数 | `boolean` | false | - |
| span | 配置查询表单的列数 | `number` \| [ColConfig](#ColConfig) | defaultColConfig | - |
| submitText | 提交按钮的文本 | `string` | `'提交'` | - |
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value formatting is inconsistent. String type default values should be wrapped in backticks according to AGENTS.md line 185. Change '提交' to `'提交'` or `提交` for consistency.

Copilot uses AI. Check for mistakes.
| columnEmptyText | 空值时的显示,不设置时显示 `-`,false 可以关闭此功能 | `ProFieldEmptyText` | `'-'` | - |
| columnsState | 受控的列状态,可以操作显示隐藏 | `ColumnStateType` | - | - |
| dataSource | Table 的数据,ProTable 推荐使用 `request` 来加载 | `T[]` | - | - |
| dateFormatter | 转化 dayjs 格式数据为特定类型,false 不做转化 | `'string' \| 'number' \| ((value: dayjs.Dayjs, valueType: string) => string \| number) \| false` | `'string'` | - |
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value formatting is inconsistent with the AGENTS.md specification. According to the spec (line 185), string type default values should be wrapped in backticks. The value 'string' should be formatted as `'string'` to follow the standard convention.

Copilot uses AI. Check for mistakes.
Comment on lines +346 to +350
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --------- | -------------- | ------------------------------------- | --------- | ---- |
| activeKey | 当前值 | `string` | - | - |
| items | 菜单项 | `{ key: string; label: ReactNode }[]` | - | - |
| onChange | 切换菜单的回调 | `(activeKey: string) => void` | - | - |
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value formatting is inconsistent with the AGENTS.md specification. According to the spec (line 185), string type default values should be wrapped in backticks. The value 'inline' should be formatted as `'inline'` to follow the standard convention.

Suggested change
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --------- | -------------- | ------------------------------------- | --------- | ---- |
| activeKey | 当前值 | `string` | - | - |
| items | 菜单项 | `{ key: string; label: ReactNode }[]` | - | - |
| onChange | 切换菜单的回调 | `(activeKey: string) => void` | - | - |
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --------- | -------------- | ------------------------------------- | ---------- | ---- |
| activeKey | 当前值 | `string` | - | - |
| items | 菜单项 | `{ key: string; label: ReactNode }[]` | - | - |
| onChange | 切换菜单的回调 | `(activeKey: string) => void` | - | - |

Copilot uses AI. Check for mistakes.
| locale | menu 是否使用国际化,还需要 formatMessage 的配合 | `boolean` | true | - |
| onLoadingChange | 菜单的加载状态变更 | `(loading: boolean) => void` | - | - |
| request | 远程加载菜单的方法,会自动修改 loading 状态 | `(params, defaultMenuData) => Promise<MenuDataItem[]>` | - | - |
| type | 菜单的类型 | `'sub' \| 'group'` | `'group'` | - |
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value formatting is inconsistent with the AGENTS.md specification. According to the spec (line 185), string type default values should be wrapped in backticks. The value 'group' should be formatted as `'group'` to follow the standard convention.

Copilot uses AI. Check for mistakes.
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ---- |
| title | layout 的左上角的 title | `ReactNode` | `'Ant Design Pro'` | - |
| logo | layout 的左上角 logo 的配置,可以配置url,React 组件 和 false | `ReactNode` \| `JSX.Element` \| `WithFalse<() => ReactNode \| JSX.Element>` | - | - | - |
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a duplicate "版本" (Version) column separator. The table header has 5 columns (参数, 说明, 类型, 默认值, 版本) but the separator line shows 6 columns with an extra "| ---- |" at the end. This will cause the table to render incorrectly.

Suggested change
| logo | layout 的左上角 logo 的配置,可以配置url,React 组件 和 false | `ReactNode` \| `JSX.Element` \| `WithFalse<() => ReactNode \| JSX.Element>` | - | - | - |
| logo | layout 的左上角 logo 的配置,可以配置url,React 组件 和 false | `ReactNode` \| `JSX.Element` \| `WithFalse<() => ReactNode \| JSX.Element>` | - | - |

Copilot uses AI. Check for mistakes.
Comment on lines +122 to +126
| 属性 | 描述 | 类型 | 默认值 | 版本 |
| ---------------- | ------------------------------------------------------------------- | ----------------- | --------- | ---- |
| (...buttonProps) | antd 的 [ButtonProps](https://ant.design/components/button-cn/#API) | ButtonProps | - | - |
| position | 行增加在哪里,开始或者末尾 | `'top' \| 'bottom'` | `'bottom'` | - |
| record | 需要新增的行数据,一般来说包含唯一 key | `T` | `{}` | - |
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value formatting is inconsistent with the AGENTS.md specification. String literals should be wrapped in backticks. Change 'bottom' to `'bottom'` or `bottom` following the convention shown at line 185 of AGENTS.md.

Suggested change
| 属性 | 描述 | 类型 | 默认值 | 版本 |
| ---------------- | ------------------------------------------------------------------- | ----------------- | --------- | ---- |
| (...buttonProps) | antd 的 [ButtonProps](https://ant.design/components/button-cn/#API) | ButtonProps | - | - |
| position | 行增加在哪里,开始或者末尾 | `'top' \| 'bottom'` | `'bottom'` | - |
| record | 需要新增的行数据,一般来说包含唯一 key | `T` | `{}` | - |
| 属性 | 描述 | 类型 | 默认值 | 版本 |
| ---------------- | ------------------------------------------------------------------- | ------------------- | ----------- | ---- |
| (...buttonProps) | antd 的 [ButtonProps](https://ant.design/components/button-cn/#API) | ButtonProps | - | - |
| position | 行增加在哪里,开始或者末尾 | `'top' \| 'bottom'` | `'bottom'` | - |
| record | 需要新增的行数据,一般来说包含唯一 key | `T` | `{}` | - |

Copilot uses AI. Check for mistakes.
| onCollapse | 收起按钮的事件 | `(collapsed: boolean) => void` | - | - |
| optionRender | 自定义操作栏 | `(searchConfig, formProps, dom) => ReactNode[] \| false` | - | - |
| resetText | 重置按钮的文本 | `string` | `'重置'` | - |
| searchText | 查询按钮的文本 | `string` | `'查询'` | - |
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value formatting is inconsistent. String type default values should be wrapped in backticks according to AGENTS.md line 185. Change '查询' to `'查询'` or `查询` for consistency.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

优化了 API 文档以符合 AGENTS.md 规范,主要改进包括:修复了 scripts/readApi.mjs 中由于错误的导入导致的脚本运行问题;在 layout.mdtable.md 的 API 表格中统一增加了“版本”列;对大部分 API 属性进行了字母排序,并规范了类型定义与默认值的格式。整体提升了文档的一致性和可维护性。

| 参数 | 说明 | 类型 | 默认值 | 版本 |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ---- |
| title | layout 的左上角的 title | `ReactNode` | `'Ant Design Pro'` | - |
| logo | layout 的左上角 logo 的配置,可以配置url,React 组件 和 false | `ReactNode` \| `JSX.Element` \| `WithFalse<() => ReactNode \| JSX.Element>` | - | - | - |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这一行的表格列数不正确。表头定义了 5 列(参数、说明、类型、默认值、版本),但这一行由于未转义的 | 以及末尾多余的单元格,导致列数过多,这会破坏 Markdown 表格的渲染。建议将类型定义合并到同一个代码块中(并转义其中的 |),同时删除末尾多余的单元格。

Suggested change
| logo | layout 的左上角 logo 的配置,可以配置url,React 组件 和 false | `ReactNode` \| `JSX.Element` \| `WithFalse<() => ReactNode \| JSX.Element>` | - | - | - |
| logo | layout 的左上角 logo 的配置,可以配置 url,React 组件和 false | `ReactNode \| JSX.Element \| WithFalse<() => ReactNode \| JSX.Element>` | - | - |

Comment on lines +22 to +82
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ---- |
| title | layout 的左上角的 title | `ReactNode` | `'Ant Design Pro'` | - |
| logo | layout 的左上角 logo 的配置,可以配置url,React 组件 和 false | `ReactNode` \| `JSX.Element` \| `WithFalse<() => ReactNode \| JSX.Element>` | - | - | - |
| pure | 简约模式,设置了之后不渲染的任何 layout 的东西,但是会有 context,可以获取到当前菜单 | `boolean` | - | - |
| loading | layout 的加载态,设置完成之后只展示一个 loading | `boolean` | - | - |
| location | 当前应用会话的位置信息。如果你的应用创建了自定义的 history,则需要显示指定 location 属性,详见 [issue](https://github.com/ant-design/pro-components/issues/327) | `RouterTypes['location']` | isBrowser ? window\.location : undefined | - |
| appList | 跨站点导航列表 | `AppListProps` | - | - |
| appListRender | 自定义跨站点导航列表的 render 方法 | `(props: AppListProps, defaultDom: React.ReactNode) => ReactNode` | - | - |
| menuHeaderRender | 渲染 logo 和 title, 优先级比 `headerTitleRender` 更高 | `WithFalse<(logo: ReactNode, title: ReactNode, props?: SiderMenuProps) => ReactNode>` | - | - |
| menuFooterRender | 在 layout 底部渲染一个块 | `WithFalse<(props?: SiderMenuProps) => ReactNode>` | - | - |
| onMenuHeaderClick | menu 菜单的头部点击事件 | `(e: React.MouseEvent<HTMLDivElement>) => void` | - | - |
| menuExtraRender | 在菜单标题的下面渲染一个区域 | `WithFalse<(props: SiderMenuProps) => ReactNode>` | - | - |
| onTopMixMenuHeaderClick | mix 模式下顶部栏的头部点击事件 | `(e: React.MouseEvent<HTMLDivElement>) => void` | - | - |
| contentStyle | layout 的内容区 style | `CSSProperties` | - | - |
| layout | layout 的菜单模式,side:右侧导航,top:顶部导航 | `'side'` \| `'top'` \| `'mix'` | `'side'` | - |
| contentWidth | layout 的内容模式,Fluid:自适应,Fixed:定宽 1200px | `'Fluid'` \| `'Fixed'` | `'Fluid'` | - |
| actionRef | layout 的常见操作,比如刷新菜单 | `React.MutableRefObject<{reload: () => void} \| undefined>` | - | - |
| fixedHeader | 是否固定 header 到顶部 | `boolean` | `false` | - |
| fixSiderbar | 是否固定导航 | `boolean` | `false` | - |
| breakpoint | 触发响应式布局的[断点](https://ant.design/components/grid-cn/#Col) | `Enum { 'xs', 'sm', 'md', 'lg', 'xl', 'xxl' }` | `lg` | - |
| menu | 关于 [menu](#menu) 的配置,暂时只有 locale,locale 可以关闭 menu 的自带的全球化 | [`menuConfig`](#menu) | `{ locale: true }` | - |
| iconfontUrl | 使用 [IconFont](https://ant.design/components/icon-cn/#components-icon-demo-iconfont) 的图标配置 | `URL` | - | - |
| locale | 当前 layout 的语言设置 | `LocaleType` (`'zh-CN'` \| `'zh-TW'` \| `'en-US'` \| `'it-IT'` \| `'ko-KR'`) | navigator.language | - |
| settings | layout 的设置 | [`Settings`](#Settings) | - | - |
| siderWidth | 侧边菜单宽度 | `number` | mix 模式: 215, 其他: 256 | - |
| suppressSiderWhenMenuEmpty | 在菜单为空时隐藏 Sider | `boolean` | - | - |
| defaultCollapsed | 默认的菜单的收起和展开,会受到 `breakpoint` 的影响,`breakpoint=false` 生效 | `boolean` | - | - |
| collapsed | 控制菜单的收起和展开,layout 是严格受控的,可以设置为 true,一直收起 | `boolean` | - | - |
| onCollapse | 收起和展开的时候触发事件 | `(collapsed: boolean) => void` | - | - |
| onPageChange | 页面切换的时候触发 | `(location?: RouterTypes['location']) => void` | - | - |
| headerRender | 自定义头的 render 方法 | `WithFalse<(props: ProLayoutProps & {hasSiderMenu?: boolean}, defaultDom: ReactNode) => ReactNode>` | - | - |
| headerTitleRender | 自定义头标题的方法,mix 模式和 top 模式下生效 | `WithFalse<(logo: ReactNode, title: ReactNode, props: HeaderViewProps) => ReactNode>` | - | - |
| headerContentRender | 自定义头内容的方法 | `WithFalse<(props: HeaderViewProps, defaultDom: ReactNode) => ReactNode>` | - | - |
| avatarProps | layout 的头像设置,不同的 layout 放在不同的位置 | `WithFalse<AvatarProps & {title?: ReactNode, render?: (avatarProps: AvatarProps, defaultDom: ReactNode, props: SiderMenuProps) => ReactNode}>` | - | - |
| actionsRender | Layout的操作功能列表,不同的 layout 会放到不同的位置 | `WithFalse<(props: HeaderViewProps) => ReactNode[] \| ReactNode>` | - | - |
| collapsedButtonRender | 自定义展开收起按钮的渲染 | `WithFalse<(collapsed: boolean) => ReactNode>` | - | - |
| footerRender | 自定义页脚的 render 方法 | `WithFalse<(props: ProLayoutProps & {hasSiderMenu?: boolean}, defaultDom: ReactNode) => ReactNode>` | - | - |
| pageTitleRender | 自定义页面标题的显示方法 | `WithFalse<(props: GetPageTitleProps, defaultPageTitle?: string, info?: {title: string, id: string, pageName: string}) => string>` | - | - |
| menuRender | 虽然叫menuRender,但是其实是整个 SiderMenu 面板的渲染函数 | `WithFalse<(props: HeaderViewProps, defaultDom: ReactNode) => ReactNode>` | - | - |
| postMenuData | 在显示前对菜单数据进行查看,修改不会触发重新渲染 | `(menuData: MenuDataItem[]) => MenuDataItem[]` | - | - |
| menuItemRender | 自定义菜单项的 render 方法 | `(itemProps: MenuDataItem, defaultDom: ReactNode, props: BaseMenuProps) => ReactNode` | - | - |
| subMenuItemRender | 自定义拥有子菜单菜单项的 render 方法 | `(itemProps: MenuDataItem) => ReactNode` | - | - |
| menuDataRender | 处理 menuData 的数据,可以动态的控制数据 | `(menuData: MenuDataItem[]) => MenuDataItem[]` | - | - |
| breadcrumbRender | 设置 PageHeader 的面包屑,只能处理数据 | `WithFalse<(routers: BreadcrumbProps['items']) => BreadcrumbProps['items']>` | - | - |
| breadcrumbProps | PageHeader 的 BreadcrumbProps 配置,会透传下去 | `Omit<BreadcrumbProps, 'itemRender'> & LayoutBreadcrumbProps` | - | - |
| itemRender | 处理每个面包屑的配置,需要直接返回 dom | `BreadcrumbProps['itemRender']` | - | - |
| route | 用于生成菜单和面包屑。Umi 的 Layout 会自动带有 | [route](#route) | - | - |
| disableMobile | 是否禁用移动端模式 | `boolean` | `false` | - |
| ErrorBoundary | 错误处理组件 | `React.ComponentClass<any, any> \| boolean` | 内置 ErrorBoundary | - |
| links | 显示在菜单右下角的快捷操作 | `ReactNode[]` | - | - |
| menuProps | 传递到 antd menu 组件的 props, 参考 [导航菜单](https://ant.design/components/menu-cn/) | `MenuProps` | - | - |
| waterMarkProps | 水印的相关配置 | `WatermarkProps` | - | - |
| formatMessage | 国际化方法 | `(message: MessageDescriptor) => string` | - | - |
| siderMenuType | 侧边菜单的类型, menu.type 的快捷方式 | `'sub'` \| `'group'` | - | - |
| isChildrenLayout | 是否为子布局 | `boolean` | - | - |
| bgLayoutImgList | Layout 的品牌配置,表现为一张背景图片 | `{src?: string, width?: string, height?: string, left?: number, top?: number, bottom?: number, right?: number}[]` | - | - |
| stylish | 样式配置 | `{header?: GenerateStyle<SiderMenuToken>, sider?: GenerateStyle<SiderMenuToken>}` | - | - |
| className | 外层容器的 className | `string` | - | - |
| style | 外层容器的 style | `React.CSSProperties` | - | - |
| token | Layout 的 token 配置 | `ProTokenType['layout']` | - | - |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

为了符合 AGENTS.md 规范并保持与 ProTable 表格的一致性,建议将 ProLayout 的 API 属性也按字母顺序进行排序。目前该表格仍维持原有的逻辑顺序,而文档中其他表格(如 menuSettingDrawer 以及 table.md 中的表格)均已在此 PR 中完成了字母排序优化。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants