Skip to content

Commit d54ec3b

Browse files
committed
vue-ssr-docs/zh/non-node.md 翻译
1 parent 44582ab commit d54ec3b

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

zh/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ Vue.js 是构建客户端应用程序的框架。默认情况下,可以在浏
4141

4242
## 关于此指南
4343

44-
本指南专注于,使用 Node.js server 的服务器端单页面应用程序渲染。
45-
将 Vue 服务器端渲染(SSR)与其他后端设置进行混合使用,是其它后端自身的一个主题,本指南不包括在内。
46-
47-
将 Vue 服务器端渲染(SSR)与其他后端设置进行混合使用,是后端自身集成 SSR 的话题,我们会在 [专门章节](./non-node.md) 中进行简要讨论。
44+
本指南专注于,使用 Node.js server 的服务器端单页面应用程序渲染。将 Vue 服务器端渲染(SSR)与其他后端设置进行混合使用,是后端自身集成 SSR 的话题,我们会在 [专门章节](./non-node.md) 中进行简要讨论。
4845

4946
本指南将会非常深入,并且假设你已经熟悉 Vue.js 本身,并且具有 Node.js 和 webpack 的相当不错的应用经验。如果你倾向于使用提供了平滑开箱即用体验的更高层次解决方案,你应该去尝试使用 [Nuxt.js](https://nuxtjs.org/)。它建立在同等的 Vue 技术栈之上,但抽象出很多模板,并提供了一些额外的功能,例如静态站点生成。但是,如果你需要更直接地控制应用程序的结构,Nuxt.js 并不适合这种使用场景。无论如何,阅读本指南将更有助于更好地了解一切如何运行。
5047

zh/non-node.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Usage in non-Node.js Environments
1+
# 在非 Node.js 环境中使用
22

3-
The default build of `vue-server-renderer` assumes a Node.js environment, which makes it unusable in alternative JavaScript environments such as [PHP V8Js](https://github.com/phpv8/v8js) or [Oracle Nashorn](https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/). In 2.5+ we have shipped a build in `vue-server-renderer/basic.js` that is largely environment-agnostic, which makes it usable in the environments mentioned above.
3+
`vue-server-renderer` 在默认构建时,会预先假定有一个 Node.js 环境,这使得它在其他 JavaScript 环境(如 [PHP V8Js](https://github.com/phpv8/v8js) [Oracle Nashorn](https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/) 中无法使用。在 2.5+ 版本中,我们把那些基本上与环境无关的构建,编译到 `vue-server-renderer/basic.js` 中,这使得它可以在上述环境中使用。
44

5-
For both environments, it is necessary to first prepare the environment by mocking the `global` and `process` objects, with `process.env.VUE_ENV` set to `"server"`, and `process.env.NODE_ENV` set to `"development"` or `"production"`.
5+
对于所有环境,必须要预先在环境中模拟 `global` `process` 对象,以及将 `process.env.VUE_ENV` 设置为 `"server"` 和将 `process.env.NODE_ENV` 设置为 `"development"` `"production"`
66

7-
In Nashorn, it may also be necessary to provide a polyfill for `Promise` or `setTimeout` using Java's native timers.
7+
Nashorn 环境下,可能还需要使用 Java 原生定时器,来为 `Promise` `setTimeout` 提供 polyfill。
88

9-
Example usage in php-v8js:
9+
php-v8js 的示例用法:
1010

1111
``` php
1212
<?php
@@ -34,7 +34,7 @@ var vm = new Vue({
3434
}
3535
})
3636

37-
// exposed by `vue-server-renderer/basic.js`
37+
// 通过 `vue-server-renderer/basic.js` 暴露
3838
renderVueComponentToString(vm, (err, res) => {
3939
print(res)
4040
})

0 commit comments

Comments
 (0)