@@ -16,20 +16,21 @@ order: 10
> [Live Demo](https://vue-hn.now.sh/)
> Note: the demo may need some spin up time if nobody has accessed it for a certain period.
+笔记:如果没在特定时间段用到它,那么本示例需要一些加载时间。
>
> [[Source](https://github.com/vuejs/vue-hackernews-2.0)]
-## Features
+## 特性
-- Server Side Rendering
- - Vue + vue-router + vuex working together
- - Server-side data pre-fetching
- - Client-side state & DOM hydration
-- Single-file Vue Components
- - Hot-reload in development
- - CSS extraction for production
-- Real-time List Updates with FLIP Animation
+- 服务器端渲染
+ - Vue + vue-router + vuex
+ - 服务端数据提前获取
+ - 客户端状态 & DOM 合并
+- 单文件 Vue 组件
+ - 开发时进行热加载
+ - 生产时抽出 CSS
+- 使用 FLIP 动画进行实时列表更新
-## Architecture Overview
+## 结构概览

diff --git a/src/examples/index.md b/src/examples/index.md
index 3c4cdcf96c..56ee85c3c8 100644
--- a/src/examples/index.md
+++ b/src/examples/index.md
@@ -1,9 +1,9 @@
---
-title: Markdown Editor
+title: Markdown 编辑器
type: examples
order: 0
---
-> Dead simple Markdown editor.
+> 蠢萌的 Markdown 编辑器。
diff --git a/src/examples/modal.md b/src/examples/modal.md
index fc1e0a9e3f..2ab4ebd3aa 100644
--- a/src/examples/modal.md
+++ b/src/examples/modal.md
@@ -1,9 +1,9 @@
---
-title: Modal Component
+title: 模式组件
type: examples
order: 6
---
-> Features used: component, prop passing, content insertion, transitions.
+> 使用到的特性:组件,prop 传递,内容插入(content insertion),过渡(transitions)。
diff --git a/src/examples/select2.md b/src/examples/select2.md
index 2e00768eb2..e21f3beb2a 100644
--- a/src/examples/select2.md
+++ b/src/examples/select2.md
@@ -1,9 +1,9 @@
---
-title: Wrapper Component
+title: 内嵌组件
type: examples
order: 8
---
-> In this example we are integrating a 3rd party jQuery plugin (select2) by wrapping it inside a custom component.
+> 在本例中,我们整合了第三方 jQuery 插件(select2),怎么做到的呢?就是把它内嵌在一个常用组件中==
diff --git a/src/examples/svg.md b/src/examples/svg.md
index 38756f623e..67e7c0059b 100644
--- a/src/examples/svg.md
+++ b/src/examples/svg.md
@@ -1,9 +1,9 @@
---
-title: SVG Graph
+title: SVG 图表
type: examples
order: 5
---
-> This example showcases a combination of custom component, computed property, two-way binding and SVG support.
+> 本示例展示了一个结合体,它由常用组件、计算属性、2 种绑定方式和 SVG 的支持组成。
diff --git a/src/examples/todomvc.md b/src/examples/todomvc.md
index c70ee3a395..8b6b8508d6 100644
--- a/src/examples/todomvc.md
+++ b/src/examples/todomvc.md
@@ -4,6 +4,6 @@ type: examples
order: 9
---
-> This is a fully spec-compliant TodoMVC implementation in under 120 effective lines of JavaScript (excluding comments and blank lines).
+> 本例是一个完全和规范一致的 TodoMVC 实现,只用了 120 行有效的 JavaScript(不包含注释和空行)。
diff --git a/src/examples/tree-view.md b/src/examples/tree-view.md
index 071bfb1d5e..3c501a7f72 100644
--- a/src/examples/tree-view.md
+++ b/src/examples/tree-view.md
@@ -1,9 +1,9 @@
---
-title: Tree View
+title: 树形视图
type: examples
order: 4
---
-> Example of a simple tree view implementation showcasing recursive usage of components.
+> 本示例是一个简单的树形视图实现,它展现了组件的递归使用。
From 2aa6ab0d5abdd7431ce580780b346bbdab8e8a21 Mon Sep 17 00:00:00 2001
From: hukee <651841877@qq.com>
Date: Sat, 8 Oct 2016 08:58:45 +0800
Subject: [PATCH 3/4] Add files via upload
---
src/plugins.md | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
create mode 100644 src/plugins.md
diff --git a/src/plugins.md b/src/plugins.md
new file mode 100644
index 0000000000..5b98d60f69
--- /dev/null
+++ b/src/plugins.md
@@ -0,0 +1,85 @@
+---
+title: 插件
+type: guide
+order: 18
+---
+
+## 开发插件
+
+
+插件通常会为Vue添加全局功能。插件的范围没有限制--一般有下面几种:
+
+1. 添加全局方法或者属性,如: [vue-element](https://github.com/vuejs/vue-element)
+
+2. 添加全局资源:指令/过滤器/过渡等。如 vue-touch [vue-touch](https://github.com/vuejs/vue-touch)
+
+3. 通过全局 mixin方法 添加一些组件选项。 如: [vuex](https://github.com/vuejs/vuex)
+
+4. 添加 Vue 实例方法,通过把它们添加到 Vue.prototype 上实现。
+
+5. A一个库,提供自己的 API,同时提供上面提到的一个或多个功能。如 [vue-router](https://github.com/vuejs/vue-router)
+
+Vue.js 的插件应当有一个公开方法 `install` 。这个方法的第一个参数是 `Vue` 构造器 , 第二个参数是一个可选的选项对象:
+
+``` js
+MyPlugin.install = function (Vue, options) {
+ // 1. 添加全局方法或属性
+ Vue.myGlobalMethod = function () {
+ // something logic ...
+ }
+
+ // 2. 添加全局资源
+ Vue.directive('my-directive', {
+ bind (el, binding, vnode, oldVnode) {
+ // something logic ...
+ }
+ ...
+ })
+
+ // 3. 注入组件
+ Vue.mixin({
+ created: function () {
+ // something logic ...
+ }
+ ...
+ })
+
+ // 4. 添加事例方法
+ Vue.prototype.$myMethod = function (options) {
+ // something logic ...
+ }
+}
+```
+
+## 使用插件
+
+通过 Vue.use() 全局方法使用插件:
+
+``` js
+// 调用 `MyPlugin.install(Vue)`
+Vue.use(MyPlugin)
+```
+
+也可以传入一个选项对象:
+
+``` js
+Vue.use(MyPlugin, { someOption: true })
+```
+
+`Vue.use` 会自动阻止注册相同插件多次,届时只会注册一次该插件。
+
+一些插件,如 `vue-router` 如果 `Vue` 是全局变量则自动调用`Vue.use()` 。不过在模块环境中应当始终显式调用 `Vue.use()` :
+
+``` js
+// 通过 Browserify 或 Webpack 使用 CommonJS 兼容模块
+var Vue = require('vue')
+var VueRouter = require('vue-router')
+
+// 不要忘了调用此方法
+Vue.use(VueRouter)
+```
+
+[awesome-vue](https://github.com/vuejs/awesome-vue#libraries--plugins) 集合了来自社区贡献的数以千计的插件和库。
+
+
+
From a95037aa4b556443c0354e8847c8ebf183bf4ebb Mon Sep 17 00:00:00 2001
From: lizhihua <275091674@qq.com>
Date: Sat, 8 Oct 2016 11:06:31 +0800
Subject: [PATCH 4/4] index.md
---
src/api/index.md | 92 ++++++++++++++++++++++++------------------------
1 file changed, 46 insertions(+), 46 deletions(-)
diff --git a/src/api/index.md b/src/api/index.md
index 5813bb176d..92bc38c67a 100644
--- a/src/api/index.md
+++ b/src/api/index.md
@@ -1629,37 +1629,36 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
- **See also:** [Named Slots](/guide/components.html#Named-Slots)
-## Built-In Components
+## 内置的组件
### component
-- **Props:**
+- **特性:**
- `is` - string | ComponentDefinition | ComponentConstructor
- `inline-template` - boolean
-- **Usage:**
+- **用法:**
- A "meta component" for rendering dynamic components. The actual component to render is determined by the `is` prop:
+ 动态渲染一个“元组件”。实际由 `is` 属性决定哪个渲染组件。
```html
-
-
+
-
+
```
-- **See also:** [Dynamic Components](/guide/components.html#Dynamic-Components)
+- **另见:** [动态组件](/guide/components.html#动态组件)
### transition
-- **Props:**
- - `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"`.
- - `appear` - boolean, Whether to apply transition on initial render. Defaults to `false`.
- - `css` - boolean, Whether to apply CSS transition classes. Defaults to `true`. If set to `false`, will only trigger JavaScript hooks registered via component events.
- - `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.
- - `mode` - string, Controls the timing sequence of leaving/entering transitions. Available modes are `"out-in"` and `"in-out"`; defaults to simultaneous.
+- **特性:**
+ - `name` - string, 用于自动生成 CSS 过渡类名。例如:`name: 'fade'` 将自动拓展为`.fade-enter`,`.fade-enter-active`等。默认类名为 `"v"`
+ - `appear` - boolean, 是否在初始渲染时使用过渡。默认为 `false`。
+ - `css` - boolean, 是否使用 CSS 过渡类。默认为 `true`。如果设置为 `false`,将只通过组件事件触发注册的 JavaScript 钩子。
+ - `type` - string, 指定过渡事件类型,侦听过渡何时结束。有效值为 `"transition"` 和 `"animation"`。默认 Vue.js 将自动检测出持续时间长的为过渡事件类型。
+ - `mode` - string, 控制离开/进入的过渡时间序列。有效的模式有 `"out-in"` 和 `"in-out"`;默认同时生效。
- `enter-class` - string
- `leave-class` - string
- `enter-active-class` - string
@@ -1667,7 +1666,7 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
- `appear-class` - string
- `appear-active-class` - string
-- **Events:**
+- **事件:**
- `before-enter`
- `enter`
- `after-enter`
@@ -1678,22 +1677,22 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
- `appear`
- `after-appear`
-- **Usage:**
+- **用法:**
- `
` serve as transition effects for **single** element/component. The `` 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.
+ `` 元素作为单个元素/组件的过渡效果。`` 不会渲染额外的 DOM 元素,也不会出现在检测过的组件层级中。它只是将内容包裹在其中,简单的运用过渡行为。
```html
-
+
toggled content
-
+
-
+
toggled content
@@ -1706,32 +1705,32 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
...
methods: {
transitionComplete: function (el) {
- // for passed 'el' that DOM element as the argument, something ...
+ // 传入 'el' 这个 DOM 元素作为参数。
}
}
...
}).$mount('#transition-demo')
```
-- **See also:** [Transitions: Entering, Leaving, and Lists](/guide/transitions.html)
+- **另见:** [过渡:进入,离开和列表](/guide/transitions.html)
### transition-group
-- **Props:**
- - `tag` - string, defaults to `span`.
- - `move-class` - overwrite CSS class applied during moving transition.
- - exposes the same props as `` except `mode`.
+- **特性:**
+ - `tag` - string, 默认为 `span`
+ - `move-class` - 覆盖移动过渡期间应用的 CSS 类。
+ - 除了 `mode`,其他特性和 `` 相同。
-- **Events:**
- - exposes the same events as ``.
+- **事件:**
+ - 事件和 `` 相同.
-- **Usage:**
+- **用法:**
- `` serve as transition effects for **multiple** elements/components. The `` renders a real DOM element. By default it renders a ``, and you can configure what element is should render via the `tag` attribute.
+ `` 元素作为多个元素/组件的过渡效果。`` 渲染一个真实的 DOM 元素。默认渲染 ``,可以通过 `tag` 属性配置哪个元素应该被渲染。
- Note every child in a `` must be **uniquely keyed** for the animations to work properly.
+ 注意,每个 `` 的子节点必须有 **独立的key** ,动画才能正常工作
- `` 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/).
+ `` 支持通过 CSS transform 过渡移动。当一个子节点被更新,从屏幕上的位置发生变化,它将会获取应用 CSS 移动类(通过 `name` 属性或配置 `move-class` 属性自动生成)。如果 CSS `transform` 属性是“可过渡”属性,当应用移动类时,将会使用 [FLIP 技术](https://aerotwist.com/blog/flip-your-animations/) 使元素流畅地到达动画终点。
```html
@@ -1741,31 +1740,31 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
```
-- **See also:** [Transitions: Entering, Leaving, and Lists](/guide/transitions.html)
+- **另见:** [过渡:进入,离开和列表](/guide/transitions.html)
### keep-alive
-- **Usage:**
+- **用法:**
- When wrapped around a dynamic component, `` caches the inactive component instances without destroying them. Similar to ``, `` is an abstract component: it doesn't render a DOM element itself, and doesn't show up in the component parent chain.
+ `` 包裹动态组件时,会缓存不活动的组件实例,而不是销毁它们。和 `` 相似,`` 是一个抽象组件:它自身不会渲染一个 DOM 元素,也不会出现在父组件链中。
- When a component is toggled inside ``, its `activated` and `deactivated` lifecycle hooks will be invoked accordingly.
+ 当组件在 `` 内被切换,它的 `activated` 和 `deactivated` 这两个生命周期钩子函数将会被对应执行。
- Primarily used with preserve component state or avoid re-rendering.
+ 主要用于保留组件状态或避免重新渲染。
```html
-
+
-
+
-
+
@@ -1773,22 +1772,23 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
```
- `` does not work with functional components because they do not have instances to be cached.
+ `` 不会在函数式组件中正常工作,因为它们没有缓存实例。
-- **See also:** [Dynamic Components - keep-alive](/guide/components.html#keep-alive)
+- **另见:** [动态组件 - keep-alive](/guide/components.html#keep-alive)
### slot
-- **Props:**
- - `name` - string, Used for named slot.
+- **特性:**
+ - `name` - string, 用于命名插槽。
- **Usage:**
- `` serve as content distribution outlets in component templates. `` itself will be replaced.
+ `` 元素作为组件模板之中的内容分发插槽。 `` 元素自身将被替换。
+ 详细用法,请参考下面 guide 部分的链接。
For detailed usage, see the guide section linked below.
-- **See also:** [Content Distribution with Slots](/guide/components.html#Content-Distribution-with-Slots)
+- **另见:** [使用Slots分发内容](/guide/components.html#使用Slots分发内容)
## VNode接口