Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n(zh-cn): Update astro-pages.mdx #10426

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/content/docs/zh-cn/basics/astro-pages.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 页面
description: Astro 页面简介
description: Astro 页面简介
---

import ReadMore from '~/components/ReadMore.astro';
Expand Down Expand Up @@ -150,9 +150,7 @@ const { error } = Astro.props

局部页面与渲染库结合时,局部页面提供了一种可以代替 [Astro 岛屿](/zh-cn/concepts/islands/)和 [`<script>` 标签](/zh-cn/guides/client-side-scripts/)方式用于在 Astro 中构建动态内容的方法。

可以导出值(例如`.astro`,`.mdx`)的页面文件将被标记为局部页面。

通过添加以下导出项来将 `src/pages/` 目录中的文件配置为局部页面:
可以导出一个值为 [`partial`](/zh-cn/reference/routing-reference/#partial) 的页面文件(例如 `.astro` 和 `.mdx`,但不是 `.md`)可以标记为局部页面。

```astro title="src/pages/partial.astro" ins={2}
---
Expand All @@ -161,11 +159,6 @@ export const partial = true;
<li>我是一个局部页面!</li>
```

`export const partial` 必须是静态标识。它可以是以下值之一:

- 布尔值 __`true`__。
- 使用 `import.meta.env` 的环境变量,如 `import.meta.env.USE_PARTIALS`。

### 和库搭配使用

局部页面用于使用诸如 [htmx](https://htmx.org/) 的库动态更新页面的某个部分。
Expand Down
Loading