Skip to content

Commit ae5dc5a

Browse files
authored
Merge pull request #2 from vuefe/2.0-cn
update
2 parents 54255bd + 0f2be41 commit ae5dc5a

File tree

14 files changed

+187
-280
lines changed

14 files changed

+187
-280
lines changed

src/api/index.md

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,45 +1629,44 @@ type: api
16291629

16301630
- **See also:** [Named Slots](/guide/components.html#Named-Slots)
16311631

1632-
## Built-In Components
1632+
## 内置的组件
16331633

16341634
### component
16351635

1636-
- **Props:**
1636+
- **特性:**
16371637
- `is` - string | ComponentDefinition | ComponentConstructor
16381638
- `inline-template` - boolean
16391639

1640-
- **Usage:**
1640+
- **用法:**
16411641

1642-
A "meta component" for rendering dynamic components. The actual component to render is determined by the `is` prop:
1642+
动态渲染一个“元组件”。实际由 `is` 属性决定哪个渲染组件。
16431643

16441644
```html
1645-
<!-- a dynamic component controlled by -->
1646-
<!-- the `componentId` property on the vm -->
1645+
<!-- 动态组件由 vm 实例的属性值 `componentId` 控制 -->
16471646
<component :is="componentId"></component>
16481647

1649-
<!-- can also render registered component or component passed as prop -->
1648+
<!-- 也能够渲染注册过的组件或 prop 传入的组件 -->
16501649
<component :is="$options.components.child"></component>
16511650
```
16521651

1653-
- **See also:** [Dynamic Components](/guide/components.html#Dynamic-Components)
1652+
- **另见:** [动态组件](/guide/components.html#动态组件)
16541653

16551654
### transition
16561655

1657-
- **Props:**
1658-
- `name` - string, Used to automatically generate transition CSS class names. e.g. `name: 'fade'` will auto expand to `.fade-enter`, `.fade-enter-active`, etc. Defaults to `"v"`.
1659-
- `appear` - boolean, Whether to apply transition on initial render. Defaults to `false`.
1660-
- `css` - boolean, Whether to apply CSS transition classes. Defaults to `true`. If set to `false`, will only trigger JavaScript hooks registered via component events.
1661-
- `type` - string, Specify the type of transition events to wait for to determine transition end timing. Available values are `"transition"` and `"animation"`. By default, it will automatically detect the type that has a longer duration.
1662-
- `mode` - string, Controls the timing sequence of leaving/entering transitions. Available modes are `"out-in"` and `"in-out"`; defaults to simultaneous.
1656+
- **特性:**
1657+
- `name` - string, 用于自动生成 CSS 过渡类名。例如:`name: 'fade'` 将自动拓展为`.fade-enter``.fade-enter-active`等。默认类名为 `"v"`
1658+
- `appear` - boolean, 是否在初始渲染时使用过渡。默认为 `false`
1659+
- `css` - boolean, 是否使用 CSS 过渡类。默认为 `true`。如果设置为 `false`,将只通过组件事件触发注册的 JavaScript 钩子。
1660+
- `type` - string, 指定过渡事件类型,侦听过渡何时结束。有效值为 `"transition"` `"animation"`。默认 Vue.js 将自动检测出持续时间长的为过渡事件类型。
1661+
- `mode` - string, 控制离开/进入的过渡时间序列。有效的模式有 `"out-in"` `"in-out"`;默认同时生效。
16631662
- `enter-class` - string
16641663
- `leave-class` - string
16651664
- `enter-active-class` - string
16661665
- `leave-active-class` - string
16671666
- `appear-class` - string
16681667
- `appear-active-class` - string
16691668

1670-
- **Events:**
1669+
- **事件:**
16711670
- `before-enter`
16721671
- `enter`
16731672
- `after-enter`
@@ -1678,22 +1677,22 @@ type: api
16781677
- `appear`
16791678
- `after-appear`
16801679

1681-
- **Usage:**
1680+
- **用法:**
16821681

1683-
`<transition>` serve as transition effects for **single** element/component. The `<transition>` does not render an extra DOM element, nor does it show up in the inspected component hierarchy. It simply applies the transition behavior to the wrapped content inside.
1682+
`<transition>` 元素作为单个元素/组件的过渡效果。`<transition>` 不会渲染额外的 DOM 元素,也不会出现在检测过的组件层级中。它只是将内容包裹在其中,简单的运用过渡行为。
16841683

16851684
```html
1686-
<!-- simple element -->
1685+
<!-- 简单元素 -->
16871686
<transition>
16881687
<div v-if="ok">toggled content</div>
16891688
</transition>
16901689

1691-
<!-- dynamic component -->
1690+
<!-- 动态组件 -->
16921691
<transition name="fade" mode="out-in" appear>
16931692
<component :is="view"></component>
16941693
</transition>
16951694

1696-
<!-- event hooking -->
1695+
<!-- 事件钩子 -->
16971696
<div id="transition-demo">
16981697
<transition @after-enter="transitionComplete">
16991698
<div v-show="ok">toggled content</div>
@@ -1706,32 +1705,32 @@ type: api
17061705
...
17071706
methods: {
17081707
transitionComplete: function (el) {
1709-
// for passed 'el' that DOM element as the argument, something ...
1708+
// 传入 'el' 这个 DOM 元素作为参数。
17101709
}
17111710
}
17121711
...
17131712
}).$mount('#transition-demo')
17141713
```
17151714

1716-
- **See also:** [Transitions: Entering, Leaving, and Lists](/guide/transitions.html)
1715+
- **另见:** [过渡:进入,离开和列表](/guide/transitions.html)
17171716

17181717
### transition-group
17191718

1720-
- **Props:**
1721-
- `tag` - string, defaults to `span`.
1722-
- `move-class` - overwrite CSS class applied during moving transition.
1723-
- exposes the same props as `<transition>` except `mode`.
1719+
- **特性:**
1720+
- `tag` - string, 默认为 `span`
1721+
- `move-class` - 覆盖移动过渡期间应用的 CSS 类。
1722+
- 除了 `mode`,其他特性和 `<transition>` 相同。
17241723

1725-
- **Events:**
1726-
- exposes the same events as `<transition>`.
1724+
- **事件:**
1725+
- 事件和 `<transition>` 相同.
17271726

1728-
- **Usage:**
1727+
- **用法:**
17291728

1730-
`<transition-group>` serve as transition effects for **multiple** elements/components. The `<transition-group>` renders a real DOM element. By default it renders a `<span>`, and you can configure what element is should render via the `tag` attribute.
1729+
`<transition-group>` 元素作为多个元素/组件的过渡效果。`<transition-group>` 渲染一个真实的 DOM 元素。默认渲染 `<span>`,可以通过 `tag` 属性配置哪个元素应该被渲染。
17311730

1732-
Note every child in a `<transition-group>` must be **uniquely keyed** for the animations to work properly.
1731+
注意,每个 `<transition-group>` 的子节点必须有 **独立的key** ,动画才能正常工作
17331732

1734-
`<transition-group>` supports moving transitions via CSS transform. When a child's position on screen has changed after an updated, it will get applied a moving CSS class (auto generated from the `name` attribute or configured with the `move-class` attribute). If the CSS `transform` property is "transition-able" when the moving class is applied, the element will be smoothly animated to its destination using the [FLIP technique](https://aerotwist.com/blog/flip-your-animations/).
1733+
`<transition-group>` 支持通过 CSS transform 过渡移动。当一个子节点被更新,从屏幕上的位置发生变化,它将会获取应用 CSS 移动类(通过 `name` 属性或配置 `move-class` 属性自动生成)。如果 CSS `transform` 属性是“可过渡”属性,当应用移动类时,将会使用 [FLIP 技术](https://aerotwist.com/blog/flip-your-animations/) 使元素流畅地到达动画终点。
17351734

17361735
```html
17371736
<transition-group tag="ul" name="slide">
@@ -1741,54 +1740,55 @@ type: api
17411740
</transition-group>
17421741
```
17431742

1744-
- **See also:** [Transitions: Entering, Leaving, and Lists](/guide/transitions.html)
1743+
- **另见:** [过渡:进入,离开和列表](/guide/transitions.html)
17451744

17461745
### keep-alive
17471746

1748-
- **Usage:**
1747+
- **用法:**
17491748

1750-
When wrapped around a dynamic component, `<keep-alive>` caches the inactive component instances without destroying them. Similar to `<transition>`, `<keep-alive>` is an abstract component: it doesn't render a DOM element itself, and doesn't show up in the component parent chain.
1749+
`<keep-alive>` 包裹动态组件时,会缓存不活动的组件实例,而不是销毁它们。和 `<transition>` 相似,`<keep-alive>` 是一个抽象组件:它自身不会渲染一个 DOM 元素,也不会出现在父组件链中。
17511750

1752-
When a component is toggled inside `<keep-alive>`, its `activated` and `deactivated` lifecycle hooks will be invoked accordingly.
1751+
当组件在 `<keep-alive>` 内被切换,它的 `activated` `deactivated` 这两个生命周期钩子函数将会被对应执行。
17531752

1754-
Primarily used with preserve component state or avoid re-rendering.
1753+
主要用于保留组件状态或避免重新渲染。
17551754

17561755
```html
1757-
<!-- basic -->
1756+
<!-- 基本 -->
17581757
<keep-alive>
17591758
<component :is="view"></component>
17601759
</keep-alive>
17611760

1762-
<!-- multiple conditional children -->
1761+
<!-- 多个条件判断的子组件 -->
17631762
<keep-alive>
17641763
<comp-a v-if="a > 1"></comp-a>
17651764
<comp-b v-else></comp-b>
17661765
</keep-alive>
17671766

1768-
<!-- used together with <transition> -->
1767+
<!-- <transition> 一起使用 -->
17691768
<transition>
17701769
<keep-alive>
17711770
<component :is="view"></component>
17721771
</keep-alive>
17731772
</transition>
17741773
```
17751774

1776-
<p class="tip">`<keep-alive>` does not work with functional components because they do not have instances to be cached.</p>
1775+
<p class="tip">`<keep-alive>` 不会在函数式组件中正常工作,因为它们没有缓存实例。</p>
17771776

1778-
- **See also:** [Dynamic Components - keep-alive](/guide/components.html#keep-alive)
1777+
- **另见:** [动态组件 - keep-alive](/guide/components.html#keep-alive)
17791778

17801779
### slot
17811780

1782-
- **Props:**
1783-
- `name` - string, Used for named slot.
1781+
- **特性:**
1782+
- `name` - string, 用于命名插槽。
17841783

17851784
- **Usage:**
17861785

1787-
`<slot>` serve as content distribution outlets in component templates. `<slot>` itself will be replaced.
1786+
`<slot>` 元素作为组件模板之中的内容分发插槽。 `<slot>` 元素自身将被替换。
17881787

1788+
详细用法,请参考下面 guide 部分的链接。
17891789
For detailed usage, see the guide section linked below.
17901790

1791-
- **See also:** [Content Distribution with Slots](/guide/components.html#Content-Distribution-with-Slots)
1791+
- **另见:** [使用Slots分发内容](/guide/components.html#使用Slots分发内容)
17921792

17931793
## VNode接口
17941794

src/examples/commits.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: GitHub Commits
2+
title: GitHub 提交
33
type: examples
44
order: 1
55
---
66

7-
> This example fetches latest Vue.js commits data from GitHub's API and displays them as a list. You can switch between the master and dev branches.
7+
> 这个例子从 Github 的 API 中获取了最新的 Vue.js 提交数据,并且以列表形式将它们展示了出来。你可以轻松地切换 master dev 分支。
88
99
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/c5g8xnar/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/elastic-header.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Elastic Header
2+
title: 具有伸缩性的 Header
33
type: examples
44
order: 7
55
---

src/examples/firebase.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
2-
title: Firebase + Validation
2+
title: Firebase + 验证
33
type: examples
44
order: 2
55
---
66

7-
> This example uses [Firebase](https://firebase.google.com/) as the data persistence backend and syncs between clients in real time (you can try opening it in multiple browser tabs). In addition, it performs instant validation using computed properties and triggers CSS transitions when adding/removing items.
8-
7+
> 本示例使用 [Firebase](https://firebase.google.com/) 作为数据存储后端,同时在客户端进行数据实时同步(你可以在多个浏览器窗口去打开它来验证)。另外,它通过计算属性实时验证,并且添加/移除选项时触发 CSS 转变。
98
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/hkrxmp0h/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/grid-component.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Grid Component
2+
title: 网格组件
33
type: examples
44
order: 3
55
---
66

7-
> This is an example of creating a reusable grid component and using it with external data.
7+
> 本示例创建了一个可复用组件,可结合外部数据来使用它。
88
99
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/xkkbfL3L/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/hackernews.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: HackerNews Clone
2+
title: HackerNews 克隆
33
type: examples
44
order: 10
55
---
66

7-
> This is a HackerNews clone built upon HN's official Firebase API, Vue 2.0 + vue-router + vuex, with server-side rendering.
7+
> HackerNews 克隆是基于 HN 的官方 firebase APIVue 2.0 vue-router vuex 来构建的,使用服务器端渲染。
88
99
{% raw %}
1010
<div style="max-width:600px">
@@ -16,20 +16,21 @@ order: 10
1616

1717
> [Live Demo](https://vue-hn.now.sh/)
1818
> Note: the demo may need some spin up time if nobody has accessed it for a certain period.
19+
笔记:如果没在特定时间段用到它,那么本示例需要一些加载时间。
1920
>
2021
> [[Source](https://github.com/vuejs/vue-hackernews-2.0)]
2122
22-
## Features
23+
## 特性
2324

24-
- Server Side Rendering
25-
- Vue + vue-router + vuex working together
26-
- Server-side data pre-fetching
27-
- Client-side state & DOM hydration
28-
- Single-file Vue Components
29-
- Hot-reload in development
30-
- CSS extraction for production
31-
- Real-time List Updates with FLIP Animation
25+
- 服务器端渲染
26+
- Vue + vue-router + vuex
27+
- 服务端数据提前获取
28+
- 客户端状态 & DOM 合并
29+
- 单文件 Vue 组件
30+
- 开发时进行热加载
31+
- 生产时抽出 CSS
32+
- 使用 FLIP 动画进行实时列表更新
3233

33-
## Architecture Overview
34+
## 结构概览
3435

3536
<img width="973" alt="Hackernew clone architecture overview" src="/images/hn-architecture.png">

src/examples/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Markdown Editor
2+
title: Markdown 编辑器
33
type: examples
44
order: 0
55
---
66

7-
> Dead simple Markdown editor.
7+
> 蠢萌的 Markdown 编辑器。
88
99
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/pq22eoj5/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/modal.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Modal Component
2+
title: 模式组件
33
type: examples
44
order: 6
55
---
66

7-
> Features used: component, prop passing, content insertion, transitions.
7+
> 使用到的特性:组件,prop 传递,内容插入(content insertion),过渡(transitions)。
88
99
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/mwLbw11k/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/select2.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Wrapper Component
2+
title: 内嵌组件
33
type: examples
44
order: 8
55
---
66

7-
> In this example we are integrating a 3rd party jQuery plugin (select2) by wrapping it inside a custom component.
7+
> 在本例中,我们整合了第三方 jQuery 插件(select2),怎么做到的呢?就是把它内嵌在一个常用组件中==
88
99
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/fruqrvdL/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/svg.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: SVG Graph
2+
title: SVG 图表
33
type: examples
44
order: 5
55
---
66

7-
> This example showcases a combination of custom component, computed property, two-way binding and SVG support.
7+
> 本示例展示了一个结合体,它由常用组件、计算属性、2 种绑定方式和 SVG 的支持组成。
88
99
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/mhrckqgq/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/todomvc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ type: examples
44
order: 9
55
---
66

7-
> This is a fully spec-compliant TodoMVC implementation in under 120 effective lines of JavaScript (excluding comments and blank lines).
7+
> 本例是一个完全和规范一致的 TodoMVC 实现,只用了 120 行有效的 JavaScript(不包含注释和空行)。
88
99
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/4dr2fLb7/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/tree-view.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Tree View
2+
title: 树形视图
33
type: examples
44
order: 4
55
---
66

7-
> Example of a simple tree view implementation showcasing recursive usage of components.
7+
> 本示例是一个简单的树形视图实现,它展现了组件的递归使用。
88
99
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/3p0j5sgy/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

0 commit comments

Comments
 (0)