Skip to content

Commit 0c205f3

Browse files
committed
fix some
1 parent 0635a9e commit 0c205f3

File tree

8 files changed

+59
-174
lines changed

8 files changed

+59
-174
lines changed

src/about/guide.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: 参与指南
3+
type: about
4+
order: 2
5+
---
6+
7+
- 加QQ群参与翻译: `427447379`
8+
- [翻译Guide认领](https://github.com/vuefe/vuejs.org/issues/1)
9+
- 待更具体教程,基于hexo

src/about/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: 关于翻译
3+
type: about
4+
order: 1
5+
---
6+
7+
- 加QQ群参与翻译: `427447379`
8+
- [翻译Guide认领](https://github.com/vuefe/vuejs.org/issues/1)

src/guide/conditional.md

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -102,78 +102,3 @@ order: 7
102102
> 原文:http://rc.vuejs.org/guide/conditional.html
103103
104104
***
105-
106-
# Conditional Rendering
107-
108-
## v-if
109-
110-
In string templates, for example Handlebars, we would write a conditional block like this:
111-
112-
``` html
113-
<!-- Handlebars template -->
114-
{{#if ok}}
115-
<h1>Yes</h1>
116-
{{/if}}
117-
```
118-
119-
In Vue, we use the `v-if` directive to achieve the same:
120-
121-
``` html
122-
<h1 v-if="ok">Yes</h1>
123-
```
124-
125-
It is also possible to add an "else" block with `v-else`:
126-
127-
``` html
128-
<h1 v-if="ok">Yes</h1>
129-
<h1 v-else>No</h1>
130-
```
131-
132-
### Template v-if
133-
134-
Because `v-if` is a directive, it has to be attached to a single element. But what if we want to toggle more than one element? In this case we can use `v-if` on a `<template>` element, which serves as an invisible wrapper. The final rendered result will not include the `<template>` element.
135-
136-
``` html
137-
<template v-if="ok">
138-
<h1>Title</h1>
139-
<p>Paragraph 1</p>
140-
<p>Paragraph 2</p>
141-
</template>
142-
```
143-
144-
### v-else
145-
146-
You can use the `v-else` directive to indicate an "else block" for `v-if`:
147-
148-
``` html
149-
<div v-if="Math.random() > 0.5">
150-
Now you see me
151-
</div>
152-
<div v-else>
153-
Now you don't
154-
</div>
155-
```
156-
157-
The `v-else` element must immediately follow the `v-if` element - otherwise it will not be recognized.
158-
159-
## v-show
160-
161-
Another option for conditionally displaying an element is the `v-show` directive. The usage is largely the same:
162-
163-
``` html
164-
<h1 v-show="ok">Hello!</h1>
165-
```
166-
167-
The difference is that an element with `v-show` will always be rendered and remain in the DOM; `v-show` simply toggles the `display` CSS property of the element.
168-
169-
<p class="tip">Note that `v-show` doesn't support the `<template>` syntax, nor does it work with `v-else`.</p>
170-
171-
## v-if vs. v-show
172-
173-
`v-if` is "real" conditional rendering because it ensures that event listeners and child components inside the conditional block are properly destroyed and re-created during toggles.
174-
175-
`v-if` is also **lazy**: if the condition is false on initial render, it will not do anything - the conditional block won't be rendered until the condition becomes true for the first time.
176-
177-
In comparison, `v-show` is much simpler - the element is always rendered regardless of initial condition, with just simple CSS-based toggling.
178-
179-
Generally speaking, `v-if` has higher toggle costs while `v-show` has higher initial render costs. So prefer `v-show` if you need to toggle something very often, and prefer `v-if` if the condition is unlikely to change at runtime.

src/guide/syntax.md

Lines changed: 36 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,44 @@ type: guide
44
order: 4
55
---
66

7-
<<<<<<< HEAD
8-
9-
Vue.js 使用一个极简的虚拟DOM实现组件渲染和插值变量。
10-
=======
117
Vue.js uses an HTML-based template syntax that allows you to declaratively bind the rendered DOM to the underlying Vue instance's data. All Vue.js templates are valid HTML that can be parsed by spec-compliant browsers and HTML parsers.
128

139
Under the hood, Vue compiles the templates into Virtual DOM render functions. Combined with the reactivity system, Vue is able to intelligently figure out the minimal amount of components to re-render and apply the minimal amount of DOM manipulations when the app state changes.
1410

1511
If you are familiar with Virtual DOM concepts and prefer the raw power of JavaScript, you can also [directly write render functions](/guide/render-function.html) instead of templates, with optional JSX support.
16-
>>>>>>> 2.0
17-
18-
Vue.js 的模板是基于 DOM 实现的。这意味着所有的 Vue.js 模板都是可解析的有效的 HTML,且通过一些特殊的特性做了增强。Vue 模板因而从根本上不同于基于字符串的模板,请记住这点。
1912

20-
## 插值
13+
## Interpolations
2114

22-
### 文本
15+
### Text
2316

24-
数据绑定最基础的形式是文本插值,使用 "Mustache" 语法(双大括号):
17+
The most basic form of data binding is text interpolation using the "Mustache" syntax (double curly braces):
2518

2619
``` html
2720
<span>Message: {{ msg }}</span>
2821
```
2922

30-
Mustache 标签会被相应数据对象的 `msg` 属性的值替换。每当这个属性变化时它也会更新。
23+
The mustache tag will be replaced with the value of the `msg` property on the corresponding data object. It will also be updated whenever the data object's `msg` property changes.
3124

32-
你也可以使用[`v-once指令`](/api/#v-once)只处理单次插值,今后的数据变化就不会再引起插值更新了,但是请记住这会影响所绑定节点中所有变化。
25+
You can also perform one-time interpolations that do not update on data change by using the [v-once directive](/api/#v-once), but keep in mind this will also affect any binding on the same node:
3326

3427
``` html
3528
<span v-once>This will never change: {{ msg }}</span>
3629
```
3730

38-
### 原始的 HTML
31+
### Raw HTML
3932

40-
双 Mustache 标签将数据解析为纯文本而不是 HTML。为了输出真的 HTML 字符串,需要用`v-html`指令:
33+
The double mustaches interprets the data as plain text, not HTML. In order to output real HTML, you will need to use the `v-html` directive:
4134

4235
``` html
4336
<div v-html="rawHtml"></div>
4437
```
4538

4639
The contents are inserted as plain HTML - data bindings are ignored. Note that you cannot use `v-html` to compose template partials, because Vue is not a string-based templating engine. Instead, components are preferred as the fundamental unit for UI reuse and composition.
4740

48-
### HTML 特性
49-
50-
Mustache 标签不可以用在 HTML 特性 (Attributes) 内,用一个[v-bind指令](http://rc.vuejs.org/guide/!!TODO)替换它
51-
52-
<<<<<<< HEAD
41+
<p class="tip">Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to [XSS attacks](https://en.wikipedia.org/wiki/Cross-site_scripting). Only use HTML interpolation on trusted content and **never** on user-provided content.</p>
5342

54-
## 绑定表达式
43+
### Attributes
5544

56-
放在 Mustache 标签内的文本称为**绑定表达式**。在 Vue.js 中,一段绑定表达式由一个简单的 JavaScript 表达式和一个可选的额外的[过滤器语法糖](http://rc.vuejs.org/guide/syntax.html#Filters)组成。
57-
58-
### JavaScript 表达式
59-
60-
到目前为止,我们的模板只绑定到简单的属性键。不过实际上 Vue.js 在数据绑定内支持全功能的 JavaScript 表达式:
61-
=======
6245
Mustaches cannot be used inside HTML attributes, instead use a [v-bind directive](/api/#v-bind):
6346

6447
``` html
@@ -74,7 +57,6 @@ It also works for boolean attributes - the attribute will be removed if the cond
7457
### Using JavaScript Expressions
7558

7659
So far we've only been binding to simple property keys in our templates. But Vue.js actually supports the full power of JavaScript expressions inside all data bindings:
77-
>>>>>>> 2.0
7860

7961
``` html
8062
{{ number + 1 }}
@@ -86,45 +68,31 @@ So far we've only been binding to simple property keys in our templates. But Vue
8668
<div v-bind:id="'list-' + id"></div>
8769
```
8870

89-
<<<<<<< HEAD
90-
这些表达式将在所属的 Vue 实例的作用域内计算。一个限制是每个绑定只能包含**单个表达式**,因此下面的语句是**无效**的:
91-
=======
9271
These expressions will be evaluated as JavaScript in the data scope of the owner Vue instance. One restriction is that each binding can only contain **one single expression**, so the following will **NOT** work:
93-
>>>>>>> 2.0
9472

9573
``` html
96-
<!-- 这是一个语句,不是一个表达式: -->
74+
<!-- this is a statement, not an expression: -->
9775
{{ var a = 1 }}
9876

99-
<!-- 流程控制也不可以,可改用三元表达式 -->
77+
<!-- flow control won't work either, use ternary expressions -->
10078
{{ if (ok) { return message } }}
10179
```
10280

103-
<<<<<<< HEAD
104-
### 过滤器
105-
106-
Vue.js 允许在表达式后添加可选的“过滤器 (Filter) ”,以“管道符”指示:
107-
=======
10881
<p class="tip">Template expressions are sandboxed and only have access to a whitelist of globals such as `Math` and `Date`. You should not attempt to access user defined globals in template expressions.</p>
10982

11083
### Filters
11184

11285
Vue.js allows you to define filters that can be used to apply common text formatting. Filters should be appended to the end of a **mustache interpolation**, denoted by the "pipe" symbol:
113-
>>>>>>> 2.0
11486

11587
``` html
11688
{{ message | capitalize }}
11789
```
11890

119-
<<<<<<< HEAD
120-
<p class="tip">Vue 2 的过滤器只可以被用在mustache绑定中。为了获得在其它绑定表达式中一样的行为,你可以使用[计算属性](http://rc.vuejs.org/guide/!!TODO)替代它</p>
121-
=======
12291
<p class="tip">Vue 2.x filters can only be used inside mustache bindings. To achieve the same behavior inside directive bindings, you should use [Computed properties](/guide/computed.html) instead.</p>
123-
>>>>>>> 2.0
12492

125-
过滤器函数总是接受表达式只做为第一个参数
93+
The filter function always receives the expression's value as the first argument.
12694

127-
```
95+
``` js
12896
new Vue({
12997
// ...
13098
filters: {
@@ -137,101 +105,81 @@ new Vue({
137105
})
138106
```
139107

140-
过滤器可以串联:
108+
Filters can be chained:
141109

142110
``` html
143111
{{ message | filterA | filterB }}
144112
```
145113

146-
过滤器也是javascript函数,也可以接受参数:
114+
Filters are JavaScript functions, therefore they can take arguments:
147115

148116
``` html
149-
{{ message | filterA 'arg1' arg2 }}
117+
{{ message | filterA('arg1', arg2) }}
150118
```
151119

152-
<<<<<<< HEAD
153-
过滤器函数始终以表达式的值作为第一个参数。带引号的参数视为字符串,而不带引号的参数按表达式计算。这里,字符串 `'arg1'` 将传给过滤器作为第二个参数,表达式 `arg2` 的值在计算出来之后作为第三个参数。
154-
=======
155120
Here, the plain string `'arg1'` will be passed into the filter as the second argument, and the value of expression `arg2` will be evaluated and passed in as the third argument.
156-
>>>>>>> 2.0
157121

158-
## 指令
122+
## Directives
159123

160-
<<<<<<< HEAD
161-
指令 (Directives) 是特殊的带有前缀 `v-` 的特性。指令的值限定为**绑定表达式**,因此上面提到的 JavaScript 表达式及过滤器规则在这里也适用。指令的职责就是当其表达式的值改变时把某些特殊的行为应用到 DOM 上。我们来回头看下“概述”里的例子:
162-
=======
163124
Directives are special attributes with the `v-` prefix. Directive attribute values are expected to be **a single JavaScript expression** (with the exception for `v-for`, which will be discussed later). A directive's job is to reactively apply side effects to the DOM when the value of its expression changes. Let's review the example we saw in the introduction:
164-
>>>>>>> 2.0
165125

166126
``` html
167127
<p v-if="seen">Now you see me</p>
168128
```
169129

170-
这里 `v-if` 指令将根据表达式 `seen` 值的真假删除/插入 `<p>` 元素。
130+
Here, the `v-if` directive would remove/insert the `<p>` element based on the truthiness of the value of the expression `seen`.
171131

172-
### 参数
132+
### Arguments
173133

174-
有些指令可以在其名称后面带一个“参数” (Argument),中间放一个冒号隔开。例如,`v-bind` 指令用于响应地更新 HTML 特性:
134+
Some directives can take an "argument", denoted by a colon after the directive name. For example, the `v-bind` directive is used to reactively update an HTML attribute:
175135

176136
``` html
177137
<a v-bind:href="url"></a>
178138
```
179139

180-
这里 `href` 是参数,它告诉 `v-bind` 指令将元素的 `href` 特性跟表达式 `url` 的值绑定。
140+
Here `href` is the argument, which tells the `v-bind` directive to bind the element's `href` attribute to the value of the expression `url`.
181141

182-
另一个例子是 `v-on` 指令,它用于监听 DOM 事件:
142+
Another example is the `v-on` directive, which listens to DOM events:
183143

184144
``` html
185145
<a v-on:click="doSomething">
186146
```
187147

188-
这里参数是被监听的事件的名字。我们也会详细说明事件绑定。
148+
Here the argument is the event name to listen to. We will talk about event handling in more detail too.
189149

190-
### 修饰符
150+
### Modifiers
191151

192-
修饰符 (Modifiers) 是以半角句号 `.` 开始的特殊后缀,用于表示指令应当以特殊方式绑定。例如 `.prevent` 修饰符告诉`v-on`指令触发`event.preventDefault()`事件:
152+
Modifiers are special postfixes denoted by a dot, which indicate that a directive should be bound in some special way. For example, the `.prevent` modifier tells the `v-on` directive to call `event.preventDefault()` on the triggered event:
193153

194154
``` html
195155
<form v-on:submit.prevent="onSubmit"></form>
196156
```
197157

198-
后面我们将看到修饰符更多的实践用法例如`v-on``v-model`
158+
We will see more use of modifiers later when we take a more thorough look at `v-on` and `v-model`.
199159

200-
## 缩写
160+
## Shorthands
201161

202-
`v-` 前缀是一种标识模板中特定的 Vue 特性的视觉暗示。当你需要在一些现有的 HTML 代码中添加动态行为时,这些前缀可以起到很好的区分效果。但你在使用一些常用指令的时候,你会感觉一直这么写实在是啰嗦。而且在构建单页应用([SPA](https://en.wikipedia.org/wiki/Single-page_application) )时,Vue.js 会管理所有的模板,此时 `v-` 前缀也没那么重要了。因此Vue.js 为两个最常用的指令 `v-bind` `v-on` 提供特别的缩写:
162+
The `v-` prefix serves as a visual cue for identifying Vue-specific attributes in your templates. This is useful when you are using Vue.js to apply dynamic behavior to some existing markup, but can feel verbose for some frequently used directives. At the same time, the need for the `v-` prefix becomes less important when you are building an [SPA](https://en.wikipedia.org/wiki/Single-page_application) where Vue.js manages every template. Therefore, Vue.js provides special shorthands for two of the most often used directives, `v-bind` and `v-on`:
203163

204-
### `v-bind` 缩写
164+
### `v-bind` Shorthand
205165

206166
``` html
207-
<!-- 完整语法 -->
167+
<!-- full syntax -->
208168
<a v-bind:href="url"></a>
209169

210-
<!-- 缩写 -->
170+
<!-- shorthand -->
211171
<a :href="url"></a>
212-
213-
<!-- 完整语法 -->
214-
<button v-bind:disabled="someDynamicCondition">Button</button>
215-
216-
<!-- 缩写 -->
217-
<button :disabled="someDynamicCondition">Button</button>
218-
219172
```
220173

221-
### `v-on` 缩写
174+
175+
### `v-on` Shorthand
222176

223177
``` html
224-
<!-- 完整语法 -->
178+
<!-- full syntax -->
225179
<a v-on:click="doSomething"></a>
226180

227-
<!-- 缩写 -->
181+
<!-- shorthand -->
228182
<a @click="doSomething"></a>
229183
```
230184

231-
它们看起来跟“合法”的 HTML 有点不同,但是 `:``@`在所有 Vue.js 支持的浏览器中都能被正确地解析,并且不会出现在最终渲染的标记中。缩写语法完全是可选的,不过随着一步步学习的深入,你会庆幸拥有它们。
232-
233-
***
234-
235-
> 原文: http://rc.vuejs.org/guide/syntax.html
236-
237-
***
185+
They may look a bit different from normal HTML, but `:` and `@` are valid chars for attribute names and all Vue.js supported browsers can parse it correctly. In addition, they do not appear in the final rendered markup. The shorthand syntax is totally optional, but you will likely appreciate it when you learn more about its usage later.

src/guide/transitions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ new Vue({
8585

8686
当插入或删除带有过渡的元素时,Vue 将:
8787

88-
<<<<<<< HEAD
8988
1. 自动嗅探目标元素是否有 CSS 过渡或动画,并在合适时添加/删除 CSS 类名。
9089

9190
2. 如果设置了过渡的 [JavaScript 钩子函数](#JavaScript-Hooks),会在相应的阶段调用它们。

src/ssr/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 服务端渲染
3-
type: changelog
3+
type: ssr
44
order: 0
55
---
66

themes/vue/layout/index.ejs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
<li><a href="/guide/" class="nav-link">教程</a></li>
55
<li><a href="/api/" class="nav-link">API</a></li>
66
<li><a href="/examples/" class="nav-link">示例</a></li>
7-
<li><a href="https://github.com/vuejs/vue/releases" target="_blank" class="nav-link">更新</a></li>
8-
<li><a href="https://github.com/vuejs/vue/issues/2873" target="_blank" class="nav-link">Vue2 changes</a></li>
9-
<li><a href="https://github.com/vuefe/vuejs.org/issues/1" target="_blank" class="nav-link">翻译</a></li>
7+
<li><a href="/changelog/" class="nav-link">更新日志</a></li>
8+
<li><a href="/about/" class="nav-link">关于翻译</a></li>
109
<li><a href="/blog" class="nav-link">博客</a></li>
1110
<%- partial('partials/community_dropdown') %>
1211
</ul>

themes/vue/layout/partials/main_menu.ejs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44
</form>
55
</li>
66
<li><a href="/guide/" class="nav-link<%- page.path.match(/guide/) ? ' current' : '' %>">教程</a></li>
7+
<li><a href="/ssr/" class="nav-link<%- page.path.match(/ssr/) ? ' current' : '' %>">SSR</a></li>
78
<li><a href="/api/" class="nav-link<%- page.path.match(/api/) ? ' current' : '' %>">API</a></li>
89
<li><a href="/examples/" class="nav-link<%- page.path.match(/examples/) ? ' current' : '' %>">示例</a></li>
9-
<li><a href="/ssr/" class="nav-link<%- page.path.match(/ssr/) ? ' current' : '' %>">SSR</a></li>
10-
<li><a href="https://github.com/vuejs/vue/releases" target="_blank">更新</a></li>
11-
<li><a href="https://github.com/vuejs/vue/issues/2873" target="_blank">Vue2 changes</a></li>
12-
<li><a href="https://github.com/vuefe/vuejs.org/issues/1" target="_blank">翻译</a></li>
13-
14-
10+
<li><a href="/changelog/" class="nav-link<%- page.path.match(/changelog/) ? ' current' : '' %>">更新日志</a></li>
11+
<li><a href="/about/" class="nav-link<%- page.path.match(/about/) ? ' current' : '' %>">关于翻译</a></li>
1512
<li><a href="/blog/" class="nav-link<%- page.path.match(/blog/) ? ' current' : '' %>">博客</a></li>
1613
<%- partial('partials/community_dropdown') %>

0 commit comments

Comments
 (0)