-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
i18n(zh-cn): Create dev-toolbar.mdx
#7589
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
05be367
i18n(zh-cn): Create `dev-toolbar.mdx`
huyikai 9abb29d
i18n(zh-cn): Update `dev-toolbar.mdx`
huyikai ac1154a
i18n(zh-cn): Update `dev-toolbar.mdx`
huyikai d026863
i18n(zh-cn): Update `dev-toolbar.mdx`
huyikai dc9ee64
Update src/content/docs/zh-cn/guides/dev-toolbar.mdx
huyikai 3c17e0c
Update src/content/docs/zh-cn/guides/dev-toolbar.mdx
huyikai 75ba9b1
Update src/content/docs/zh-cn/guides/dev-toolbar.mdx
huyikai c6a982b
Update src/content/docs/zh-cn/guides/dev-toolbar.mdx
huyikai 6d485a9
Update src/content/docs/zh-cn/guides/dev-toolbar.mdx
huyikai c371548
Update src/content/docs/zh-cn/guides/dev-toolbar.mdx
huyikai 086e6aa
Update src/content/docs/zh-cn/guides/dev-toolbar.mdx
huyikai 25728c2
Update src/content/docs/zh-cn/guides/dev-toolbar.mdx
huyikai 24601af
Update src/content/docs/zh-cn/guides/dev-toolbar.mdx
huyikai bb51c46
Update src/content/docs/zh-cn/guides/dev-toolbar.mdx
huyikai 1074ede
Update dev-toolbar.mdx
huyikai c41c351
Merge branch 'main' into 20240326-dev-toolbar.mdx
liruifengv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,83 @@ | ||||||
| --- | ||||||
| title: 开发者工具栏 | ||||||
| description: Astro 中使用开发者工具栏的指南 | ||||||
| i18nReady: true | ||||||
| --- | ||||||
|
|
||||||
| 当开发服务器运行时,Astro 会在你本地浏览器预览的每个页面底部包含一个开发者工具栏。 | ||||||
|
|
||||||
| 此工具栏包含许多有用的工具,用于在开发过程中调试和检查你的网站,并且可以在集成目录中找到[更多开发者工具栏应用](#扩展开发工具栏)进行扩展。你甚至可以使用 [开发者工具栏 API](/zh-cn/reference/dev-toolbar-app-reference/)构建你自己的应用! | ||||||
|
|
||||||
| 此工具栏默认启用,并在你将鼠标悬停在页面底部时出现。它仅是一个开发工具,并不会在你的发布网站上出现。 | ||||||
|
|
||||||
| ## 内置应用 | ||||||
|
|
||||||
| ### Astro Menu | ||||||
|
|
||||||
| Astro Menu 应用提供了便捷的方式来访问当前项目的各种信息和链接到额外资源。值得注意的是,它提供了一键访问 Astro 文档、GitHub 仓库和 Discord 服务器。 | ||||||
|
|
||||||
| 这个应用程序还包括一个 “Copy debug info” 按钮,它将运行 [`astro info`](/zh-cn/reference/cli-reference/#astro-info) 命令并将输出复制到你的剪贴板。这在请求帮助或报告问题时可能很有用。 | ||||||
|
|
||||||
| ### Inspect | ||||||
|
|
||||||
| Inspect 应用提供了当前页面上任何[群岛结构](/zh-cn/concepts/islands/)的信息。这将向你展示传递给每个群岛的属性,以及用于渲染它们的客户端指令。 | ||||||
|
|
||||||
| ### 审计 | ||||||
|
|
||||||
| Audit 应用会自动在当前页面上运行一系列审计,检查最常见的性能和无障碍问题。当发现问题时,工具栏上会出现一个红点。点击应用程序将弹出一个来自审计的结果列表,并直接在页面中高亮显示相关元素。 | ||||||
|
|
||||||
| :::note | ||||||
| 开发者工具栏执行的基本性能和可访问性审计,并不能取代专用工具如 [Pa11y](https://pa11y.org/) 或 [Lighthouse](https://developers.google.com/web/tools/lighthouse),更不用说比这些工具更好的人工审查了! | ||||||
|
|
||||||
| 开发者工具栏旨在提供一种快速简便的方式,在开发过程中捕捉常见问题,无需切换到不同的工具。 | ||||||
| ::: | ||||||
|
|
||||||
| ### 设置 | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| 设置应用程序允许你切换开发工具栏的不同设置,例如详细日志记录,以及禁用通知的能力。 | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ## 扩展开发工具栏 | ||||||
|
|
||||||
| Astro 集成可以向开发工具栏添加新的应用,允许你使用特定于你的项目的自定义工具来扩展它。你可以在[集成目录中找到更多开发工具应用进行安装](https://astro.build/integrations/?search=&categories%5B%5D=toolbar)或使用 [Astro Menu](#astro-menu)。 | ||||||
|
|
||||||
| 根据各自的安装说明,像安装任何其他 [Astro 集成](/zh-cn/guides/integrations-guide/) 一样,在你的项目中安装额外的开发工具栏应用集成。 | ||||||
|
|
||||||
| ## 禁用开发者工具栏 | ||||||
|
|
||||||
| 开发者工具栏默认为每个站点启用。你可以根据需要为单个项目和/或用户禁用它。 | ||||||
|
|
||||||
| ### 按项目 | ||||||
|
|
||||||
| 要为在项目中工作的每个人禁用开发者工具栏,请在 [Astro 配置文件](/zh-cn/reference/configuration-reference/)中设置 `devToolbar: false`。 | ||||||
|
|
||||||
| ```js title="astro.config.mjs" ins={4-6} | ||||||
| import { defineConfig } from "astro/config"; | ||||||
|
|
||||||
| export default defineConfig({ | ||||||
| devToolbar: { | ||||||
| enabled: false | ||||||
| } | ||||||
| }) | ||||||
| ``` | ||||||
|
|
||||||
| 要重新启用开发者工具栏,请从你的配置中删除这些行,或设置 `enabled: true`。 | ||||||
|
|
||||||
| ### 按用户 | ||||||
|
|
||||||
| 要在特定项目中为自己禁用开发者工具栏,请运行 [`astro preferences`](/zh-cn/reference/cli-reference/#astro-preferences) 命令。 | ||||||
|
|
||||||
| ```shell | ||||||
| astro preferences disable devToolbar | ||||||
| ``` | ||||||
|
|
||||||
| 要在当前机器上为用户在所有 Astro 项目中禁用开发者工具栏,请在运行 `astro-preferences` 时添加 `--global` 标志: | ||||||
|
|
||||||
| ```shell | ||||||
| astro preferences disable --global devToolbar | ||||||
| ``` | ||||||
|
|
||||||
| 可以稍后通过以下方式启用开发者工具栏: | ||||||
|
|
||||||
| ```shell | ||||||
| astro preferences enable devToolbar | ||||||
| ``` | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.