Skip to content
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
7 changes: 4 additions & 3 deletions src/content/docs/zh-cn/tutorial/4-layouts/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ import { Steps } from '@astrojs/starlight/components';
</BaseLayout>
```

4. 再次查看浏览器预览,注意到发生了什么变化(或者直接剧透:没有变化!)。
4. 再次查看浏览器预览,注意到发生了什么变化(剧透警告:_没有_ 变化!)。

5. 在 `src/layouts/BaseLayout.astro` 的页脚组件上方添加一个 `<slot />` 元素,然后查看你的首页在浏览器的预览中真正发生了什么变化
5. 在 `src/layouts/BaseLayout.astro` 的页脚组件上方添加一个 `<slot />` 元素,然后查看你的首页在浏览器的预览中 _真正_ 发生了什么变化

```astro title="src/layouts/BaseLayout.astro" ins={18}
---
Expand Down Expand Up @@ -137,7 +137,8 @@ import { Steps } from '@astrojs/starlight/components';

## 试一试 - 在任何地方使用你的布局

**重构**你的其他页面(`blog.astro` 和 `about.astro`),使它们使用你的新的 `<BaseLayout>` 组件来渲染共同的页面元素。
**重构**你的其他页面(`blog.astro` 和 `about.astro`),使它们使用你的新的 `<BaseLayout>` 组件来渲染共同的页面元素。(注意:使用 BaseLayout 渲染 `about.astro` 页面意味着你将丢失添加到该页面 `<head>` 的 `<style>` 标签。如果你想保留 `<h1>` 的自定义样式,需要将 style 标签移动到页面组件的 body 部分。)

不要忘记:
Comment thread
Nin3lee marked this conversation as resolved.

- 通过组件属性将页面标题作为 props 传递。
Expand Down