Skip to content

Commit 4b9a9db

Browse files
committed
更新 安装文档
1 parent 92da428 commit 4b9a9db

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

src/guide/installation.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ Vue.js 不支持 IE8 及其以下版本,因为 Vue.js 使用了 IE8 不能实
3030

3131
### CDN
3232

33-
Recommended: [unpkg](https://unpkg.com/vue/dist/vue.js), which will reflect the latest version as soon as it is published to npm. You can also browse the source of the npm package at [unpkg.com/vue/](https://unpkg.com/vue/).
33+
推荐: [unpkg](https://unpkg.com/vue/dist/vue.js), 会保持和 npm 发布的最新的版本一致。 可以在 [unpkg.com/vue/](https://unpkg.com/vue/) 浏览 npm 包资源。
3434

35-
Also available on [jsdelivr](//cdn.jsdelivr.net/vue/{{vue_version}}/vue.js) or [cdnjs](//cdnjs.cloudflare.com/ajax/libs/vue/{{vue_version}}/vue.js), but these two services take some time to sync so the latest release may not be available yet.
35+
也可以从 [jsdelivr](//cdn.jsdelivr.net/vue/{{vue_version}}/vue.js) [cdnjs](//cdnjs.cloudflare.com/ajax/libs/vue/{{vue_version}}/vue.js) 获取, 不过这两个服务版本更新可能略滞后。
3636

3737
## NPM
3838

@@ -43,15 +43,16 @@ Also available on [jsdelivr](//cdn.jsdelivr.net/vue/{{vue_version}}/vue.js) or [
4343
$ npm install vue
4444
```
4545

46-
### Standalone vs. Runtime-only Build
46+
### 独立构建 vs 运行时构建
4747

48-
There are two builds available, the standalone build and the runtime-only build.
48+
有两种构建方式,独立构建和运行构建。
4949

50-
- The standalone build includes the compiler and supports the `template` option. **It also relies on the presence of browser APIs so you cannot use it for server-side rendering.**
50+
- 独立构建包括编译和支持 `template` 选项。 **它也依赖于浏览器的接口的存在,所以你不能使用它来为服务器端渲染。
51+
**
5152

52-
- The runtime-only build does not include the template compiler, and does not support the `template` option. You can only use the `render` option when using the runtime-only build, but it works with single-file components, because single-file components' templates are pre-compiled into `render` functions during the build step. The runtime-only build is roughly 30% lighter-weight than the standalone build, weighing only 16kb min+gzip.
53+
- 运行时构建不包括模板编译, 不支持 `template` 选项。运行时构建,可以用 `render` 选项,不过得再单文件组件中起作用, 因为单文件组件的模板 是在构建时预编译到 `render` 函数中, 运行时构建只有独立构建大小的30%,只有16Kb min+gzip大小。
5354

54-
By default, the NPM package exports the **runtime-only** build. To use the standalone build, add the following alias to your webpack config:
55+
默认 NPM 包导出的是 **运行时** 构建。 为了使用独立构建, 在 webpack 配置中添加下面的别名:
5556

5657
``` js
5758
resolve: {
@@ -61,15 +62,16 @@ resolve: {
6162
}
6263
```
6364

64-
对于Browserify,可以用 [aliasify](https://github.com/benbria/aliasify)
65+
对于Browserify,可以用 [aliasify](https://github.com/benbria/aliasify)
6566

66-
<p class="tip">Do NOT do `import Vue from 'vue/dist/vue.js'` - since some tools or 3rd party libraries may import vue as well, this may cause the app to load both the runtime and standalone builds at the same time and lead to errors.</p>
67+
<p class="tip">不要用 `import Vue from 'vue/dist/vue.js'` - 由于一些工具或第三方库引入 Vue , 这可能会导致应用程序运行时加载和独立构建导致错误</p>
6768

68-
### CSP environments
69+
### CSP 环境
6970

70-
Some environments, such as Google Chrome Apps, enforce Content Security Policy (CSP), which prohibits the use of `new Function()` for evaluating expressions. The standalone build depends on this feature to compile templates, so is unusable in these environments.
71+
有些环境,如 Google Chrome Apps,强制应用内容安全策略 (CSP) ,不能使用 new Function() 对表达式求值。这时可以用 CSP 兼容版本。独立的构建取决于该功能编译模板,所以无法使用这些环境。
7172

72-
On the other hand, the runtime-only build is fully CSP-compliant. When using the runtime-only build with [Webpack + vue-loader](https://github.com/vuejs-templates/webpack-simple) or [Browserify + vueify](https://github.com/vuejs-templates/browserify-simple), your templates will be precompiled into `render` functions which work perfectly in CSP environments.
73+
74+
另一方面,运行时构建的是完成兼容CSP的。当通过 [Webpack + vue-loader](https://github.com/vuejs-templates/webpack-simple) 或者 [Browserify + vueify](https://github.com/vuejs-templates/browserify-simple) 构建时, 在 CSP 环境中模板将被完美预编译到 `render` 函数中。
7375

7476
## 命令行工具
7577

@@ -79,7 +81,7 @@ Vue.js 提供一个[官方命令行工具](https://github.com/vuejs/vue-cli),
7981
# 全局安装 vue-cli
8082
$ npm install --global vue-cli
8183
# 创建一个基于 "webpack" 模板的新项目
82-
# !!要做的:这个模板还不存在
84+
# !!要做的:这个模板还不存在 (目前 vue init webpack my-project)
8385
$ vue init webpack-2.0 my-project
8486
# 安装依赖,走你
8587
$ cd my-project
@@ -89,7 +91,7 @@ $ npm run dev
8991

9092
## 开发版本
9193

92-
**Important**: the built files in GitHub's `/dist` folder are only checked-in during releases. To use Vue from the latest source code on GitHub, you will have to build it yourself!
94+
**重要**: 在发布后构建的文件在Github仓库的 `/dist` 文件夹。 为了使用 Github 上 Vue 最新的资源,你得自己构建。
9395

9496
``` bash
9597
git clone https://github.com/vuejs/vue.git node_modules/vue

themes/vue/layout/partials/sidebar.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<li><h3>进阶</h3></li>
2727
<% } %>
2828
<% if (fileName === 'migration') { %>
29-
<li><h3>Migrating</h3></li>
29+
<li><h3>迁移</h3></li>
3030
<% } %>
3131
<% if (fileName === 'comparison') { %>
3232
<li><h3>更多</h3></li>

0 commit comments

Comments
 (0)