Skip to content

Commit e58bee2

Browse files
Merge pull request vuejs#116 from dear-lizhihua/gitlocalize-218
update zh/head.md
2 parents 324dd65 + e21c03c commit e58bee2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

zh/head.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
类似于资源注入,Head 管理遵循相同的理念:我们可以在组件的生命周期中,将数据动态地追加到渲染`上下文`(render context),然后在`模板`中的占位符替换为这些数据。
44

5-
> >=2.3.2 的版本,您可以通过 `this.$ssrContext` 来直接访问组件中的服务器端渲染上下文(SSR context)。在旧版本中,您必须通过将其传递给 `createApp()` 并将其暴露于根实例的 `$options` 上,才能手动注入服务器端渲染上下文(SSR context) - 然后子组件可以通过 `this.$root.$options.ssrContext` 来访问它。
5+
> 在 2.3.2+ 的版本,您可以通过 `this.$ssrContext` 来直接访问组件中的服务器端渲染上下文(SSR context)。在旧版本中,您必须通过将其传递给 `createApp()` 并将其暴露于根实例的 `$options` 上,才能手动注入服务器端渲染上下文(SSR context) - 然后子组件可以通过 `this.$root.$options.ssrContext` 来访问它。
66
77
我们可以编写一个简单的 mixin 来完成标题管理:
88

@@ -34,7 +34,7 @@ const clientTitleMixin = {
3434
}
3535
}
3636
}
37-
// 可以通过 webpack.DefinePlugin 注入 VUE_ENV
37+
// 可以通过 `webpack.DefinePlugin` 注入 `VUE_ENV`
3838
export default process.env.VUE_ENV === 'server'
3939
? serverTitleMixin
4040
: clientTitleMixin
@@ -76,6 +76,7 @@ export default {
7676
**注意:**
7777

7878
- 使用双花括号(double-mustache)进行 HTML 转义插值(HTML-escaped interpolation),以避免 XSS 攻击。
79+
7980
- 你应该在创建 `context` 对象时提供一个默认标题,以防在渲染过程中组件没有设置标题。
8081

8182
---

0 commit comments

Comments
 (0)