Skip to main content

组件和动态区域应使用详细填充策略(on 片段)进行填充

¥Components and dynamic zones should be populated using the detailed population strategy (on fragments)

在 Strapi 5 中,应使用详细的填充策略填充组件和动态区域,并使用 on 片段。Strapi v4 中可能的共享人口策略不再受支持。

¥In Strapi 5, components and dynamic zones should be populated using the detailed population strategy, with on fragments. The shared population strategy possible in Strapi v4 is no longer supported.

此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的其他说明。

¥This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

\🔌 此重大更改是否会影响插件?\
\🤖 此重大更改是否由 codemod 自动处理?\

重大更改描述

¥Breaking change description

在 Strapi v4 中

¥In Strapi v4

你可以使用 共享或详细的填充策略 在 REST API 调用中填充组件和动态区域。

¥You could use either the shared or the detailed population strategy to populate components and dynamic zones in a REST API call.

在 Strapi 5 中

¥In Strapi 5

你必须使用 on 片段来明确详细说明哪些组件和动态区域到 populate

¥You must use on fragments to explicitly detail which components and dynamic zones to populate.

迁移

¥Migration

本节重新组合了有关引入的重大更改的有用说明和程序。

¥This section regroups useful notes and procedures about the introduced breaking change.

注意

¥Notes

有关人口的更多信息,请参阅 REST API 文档

¥Additional information on population is available in the REST API documentation.

手动程序

¥Manual procedure

用户应确保使用 on 片段明确填充组件和动态区域,例如以下示例语法和 URL:

¥Users should ensure that components and dynamic zones are explicitly populated using on fragments, such as in the following example syntax and URL:

  • 示例通用语法:

    ¥example generic syntax:

    populate[dynamic-zone-name][on][component-category.component-name]=true

  • 示例 URL:

    ¥example URL:

    /api/articles?populate[dynamic-zone-name][on][component-category.component-name]=true