Loading...
Loading...
Compare original and translation side by side
cookies.set()cookies.set()cookiesfetchgenerateStaticParamsLinkImageScriptpagelayoutrouteuse clientuse cachebasePathimagescookiesfetchgenerateStaticParamsLinkImageScriptpagelayoutrouteuse clientuse cachebasePathimages---
title: {API name}
description: {API Reference for the {API name} {function|component|file convention|directive|config option}.}
---
{One sentence defining what it does and where it's used.}
```tsx filename="path/to/file.tsx" switcher
// Minimal working usage
```
```jsx filename="path/to/file.js" switcher
// Same example in JS
```---
title: {API名称}
description: {API名称} {函数|组件|文件约定|指令|配置选项}的API参考文档。
---
{一句话定义该API的功能及使用场景。}
```tsx filename="path/to/file.tsx" switcher
// 最简可用示例
```
```jsx filename="path/to/file.js" switcher
// 同示例的JS版本
```#### propName### Props#### propName#### propName### 属性#### propName// Complete working example// Same example in JS// 完整可用示例// 同示例的JS版本| Version | Changes |
|---|---|
| {What changed.} |
**Category-specific notes:**
- **Functions**: Lead with the function signature and `await` if async. Document methods in a table if the return value has methods (like `cookies`). Document options in a separate table if applicable.
- **Components**: Start with a props summary table (`| Prop | Example | Type | Required |`). Then document each prop under `#### propName` with description, code example, and value table where useful.
- **File conventions**: Show the default export signature with TypeScript types. Document each prop (`params`, `searchParams`, etc.) under `#### propName` with a route/URL/value example table.
- **Directives**: No `## Reference` section. Use `## Usage` instead, showing correct placement. Document serialization constraints and boundary rules.
- **Config options**: Show the `next.config.ts` snippet. Use subsections for each behavioral aspect.| 版本 | 变更内容 |
|---|---|
| {变更详情。} |
**类别特定说明:**
- **函数:**以函数签名开头,异步函数需添加`await`。如果返回值包含方法(如`cookies`),则在表格中记录方法。如有必要,单独用表格记录选项。
- **组件:**以属性汇总表格开头(`| 属性 | 示例 | 类型 | 是否必填 |`)。然后在`#### propName`下记录每个属性的描述、代码示例及有用的取值表格。
- **文件约定:**展示包含TypeScript类型的默认导出签名。在`#### propName`下记录每个属性(`params`、`searchParams`等),并附上路由/URL/取值示例表格。
- **指令:**无需`## 参考`章节,改用`## 用法`章节展示正确的使用位置。记录序列化约束和边界规则。
- **配置选项:**展示`next.config.ts`代码片段。针对每个行为方面使用子章节。## Referenceswitcherfilename="path/to/file.ext"highlight={n}####> **Good to know**:## Good to know### Example Name/docs/app/...| Don't | Do |
|---|---|
| "This powerful function lets you easily manage cookies" | " |
| "You can conveniently access..." | "Returns an object containing..." |
| "The best way to handle navigation" | " |
## 参考switcherfilename="path/to/file.ext"highlight={n}####> **补充说明:**## 补充说明### 示例名称/docs/app/...| 错误示例 | 正确示例 |
|---|---|
| "这个强大的函数让你轻松管理cookies" | " |
| "你可以方便地访问..." | "返回一个包含...的对象" |
| "处理导航的最佳方式" | " |
test/switcherfilenametest/switcherfilenamedocs/01-app/03-api-reference/04-functions/cookies.mdx03-file-conventions/page.mdx02-components/link.mdx01-directives/use-client.mdx04-functions/fetch.mdxdocs/01-app/03-api-reference/04-functions/cookies.mdx03-file-conventions/page.mdx02-components/link.mdx01-directives/use-client.mdx04-functions/fetch.mdx