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

Sync #4ba12e46 #743

Merged
merged 15 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/contributing/writing-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Writing documentation is an exercise in empathy. We're not describing an objecti

### Tips, Callouts, Alerts, and Line Highlights

We have some dedicated styles to denote something that's worth highlighting in a particular way. These are captured [on this page](https://vitepress.vuejs.org/guide/markdown.html#custom-containers). **They are to be used sparingly.**
We have some dedicated styles to denote something that's worth highlighting in a particular way. These are captured [on this page](https://vitepress.dev/guide/markdown#custom-containers). **They are to be used sparingly.**

There is a certain temptation to abuse these styles, as one can simply add a change inside a callout. However, this breaks up the flow of reading for the user and should only be used in special circumstances. Wherever possible, we should attempt to create a narrative and flow within the page to respect the reader's cognitive load.

Expand Down
382 changes: 213 additions & 169 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions src/about/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ Vue 3 是 Vue 当前的最新主版本。它包含了一些 Vue 2 中没有的

- 你需要支持 IE11。Vue 3 用到了一些 IE11 不支持的现代 JavaScript 特性。

- 你还在等待 Nuxt 或 Vuetify 等主要生态系统项目为 Vue 3 发布稳定版本。如果你不希望使用 beta 阶段的软件,这也是合理的。然而请注意这里还有一些其他已经稳定的 Vue 3 的组件库,如 [Quasar](https://quasar.dev/)、[Naive UI](https://www.naiveui.com/) 以及 [Element Plus](https://element-plus.org/)。

如果你打算将现有的 Vue 2 应用迁移到 Vue 3,请查阅我们特别整理的 [Vue 3 迁移指南](https://v3-migration.vuejs.org/)。
如果你打算将现有的 Vue 2 应用迁移到 Vue 3,请查阅[迁移指南](https://v3-migration.vuejs.org/zh/)。

## Vue 2 仍在维护吗? {#is-vue-2-still-supported}

Expand Down
2 changes: 1 addition & 1 deletion src/api/composition-api-dependency-injection.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
import { inject } from 'vue'
import { fooSymbol } from './injectionSymbols'

// 注入值的默认方式
// 注入不含默认值的静态值
const foo = inject('foo')

// 注入响应式的值
Expand Down
12 changes: 1 addition & 11 deletions src/guide/components/attrs.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,7 @@ outline: deep

<div class="composition-api">

如果你使用了 `<script setup>`,则可以使用 [`defineOptions`](/api/sfc-script-setup#defineoptions) 宏:

```vue
<script setup>
defineOptions({
inheritAttrs: false
})
</script>
```

从 3.3 开始你也可以直接在 `<script setup>` 中使用 `defineOptions`:
从 3.3 开始你也可以直接在 `<script setup>` 中使用 [`defineOptions`](/api/sfc-script-setup#defineoptions):

```vue
<script setup>
Expand Down
3 changes: 2 additions & 1 deletion src/guide/components/v-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ export default {
<div class="composition-api">

```vue{5,6,10,11}
<script setup >
<script setup>
const props = defineProps({
firstName: String,
lastName: String,
Expand Down Expand Up @@ -487,4 +487,5 @@ export default {
}
</script>
```

</div>
2 changes: 1 addition & 1 deletion src/guide/essentials/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export default {

```vue-html
<select v-model="selected">
<option v-for="option in options" :value="option.value">
<option v-for="option in options" :key="option.value" :value="option.value">
{{ option.text }}
</option>
</select>
Expand Down
5 changes: 4 additions & 1 deletion src/guide/extras/reactivity-transform.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
:::danger 已废弃的实验性功能
响应性语法糖曾经是一个实验性功能,且已被废弃,请阅读[废弃原因](https://github.com/vuejs/rfcs/discussions/369#discussioncomment-5059028)。

在未来的一个小版本更新中,它将会从 Vue core 中被移除。如需继续使用,请通过 [Vue Macros](https://vue-macros.sxzz.moe/features/reactivity-transform.html) 插件。
在未来的一个小版本更新中,它将会从 Vue core 中被移除。

- 想要摆脱它的话,请查看这个[命令行工具](https://github.com/edison1105/drop-reactivity-transform),它可以自动完成这一过程。
- 如需继续使用,请通过 [Vue Macros](https://vue-macros.sxzz.moe/features/reactivity-transform.html) 插件。
:::

:::tip 组合式 API 特有
Expand Down
2 changes: 1 addition & 1 deletion src/guide/extras/ways-of-using-vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ SSG 有两种风格:单页和多页。这两种风格都能将站点预渲染

单页 SSG 更适合于重交互、深会话的场景,或需要在导航之间持久化元素或状态。否则,多页 SSG 将是更好的选择。

Vue 团队也维护了一个名为 [VitePress](https://vitepress.vuejs.org/) 的静态站点生成器,你正在阅读的文档就是基于它构建的!VitePress 支持两种形式的 SSG。另外,[NuxtJS](https://nuxt.com/) 也支持 SSG。你甚至可以在同一个 Nuxt 应用中通过不同的路由提供 SSR 和 SSG。
Vue 团队也维护了一个名为 [VitePress](https://vitepress.dev/) 的静态站点生成器,你正在阅读的文档就是基于它构建的!VitePress 支持两种形式的 SSG。另外,[NuxtJS](https://nuxt.com/) 也支持 SSG。你甚至可以在同一个 Nuxt 应用中通过不同的路由提供 SSR 和 SSG。

## Web 之外... {#beyond-the-web}

Expand Down
4 changes: 2 additions & 2 deletions src/guide/reusability/composables.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ const { x, y } = useMouse()

```js
// event.js
import { onMounted, onBeforeUnmount } from 'vue'
import { onMounted, onUnmounted } from 'vue'

export function useEventListener(target, event, callback) {
// 如果你想的话,
// 也可以用字符串形式的 CSS 选择器来寻找目标 DOM 元素
onMounted(() => target.addEventListener(event, callback))
onBeforeUnmount(() => target.removeEventListener(event, callback))
onUnmounted(() => target.removeEventListener(event, callback))
}
```

Expand Down
2 changes: 1 addition & 1 deletion src/guide/scaling-up/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Vue.js 是一个用于构建客户端应用的框架。默认情况下,Vue 组

SSG 保留了和 SSR 应用相同的性能表现:它带来了优秀的首屏加载性能。同时,它比 SSR 应用的花销更小,也更容易部署,因为它输出的是静态 HTML 和资源文件。这里的关键词是**静态**:SSG 仅可以用于消费静态数据的页面,即数据在构建期间就是已知的,并且在多次部署期间不会改变。每当数据变化时,都需要重新部署。

如果你调研 SSR 只是为了优化为数不多的营销页面的 SEO (例如 `/`、`/about` 和 `/contact` 等),那么你可能需要 SSG 而不是 SSR。SSG 也非常适合构建基于内容的网站,比如文档站点或者博客。事实上,你现在正在阅读的这个网站就是使用 [VitePress](https://vitepress.vuejs.org/) 静态生成的,它是一个由 Vue 驱动的静态站点生成器。
如果你调研 SSR 只是为了优化为数不多的营销页面的 SEO (例如 `/`、`/about` 和 `/contact` 等),那么你可能需要 SSG 而不是 SSR。SSG 也非常适合构建基于内容的网站,比如文档站点或者博客。事实上,你现在正在阅读的这个网站就是使用 [VitePress](https://vitepress.dev/) 静态生成的,它是一个由 Vue 驱动的静态站点生成器。

## 基础教程 {#basic-tutorial}

Expand Down
4 changes: 2 additions & 2 deletions src/public/_headers
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
X-Frame-Options: ALLOW-FROM https://staging.certification.vuejs.org https://certification.vuejs.org https://certificates.dev https://staging.certificates.dev
Content-Security-Policy: frame-ancestors https://staging.certification.vuejs.org https://certification.vuejs.org https://certificates.dev https://staging.certificates.dev
X-Frame-Options: ALLOW-FROM https://staging.certification.vuejs.org https://certification.vuejs.org https://certificates.dev https://staging.certificates.dev https://alemira.com https://*.alemira.com
Content-Security-Policy: frame-ancestors https://staging.certification.vuejs.org https://certification.vuejs.org https://certificates.dev https://staging.certificates.dev https://alemira.com https://*.alemira.com

/assets/*
cache-control: max-age=31536000
Expand Down