Skip to content

Commit 0f2be41

Browse files
authored
Merge pull request #84 from dear-lizhihua/2.0-cn
api/index.md
2 parents f03af6c + 77fe705 commit 0f2be41

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
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

0 commit comments

Comments
 (0)