Skip to content
This repository was archived by the owner on Aug 8, 2022. It is now read-only.

Commit dbb6c47

Browse files
authored
Merge pull request #341 from vuejs/jinjiang/translate/custom-directive
Update custom-directive.md
2 parents 2662006 + f885539 commit dbb6c47

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/guide/custom-directive.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,7 @@ app.directive('demo', (el, binding) => {
194194

195195
## 在组件中使用
196196

197-
<!-- TODO: translation -->
198-
199-
When used on components, custom directive will always apply to component's root node, similarly to [non-prop attributes](component-attrs.html).
197+
[非 prop 的 attribute](component-attrs.html) 类似,当在组件中使用时,自定义指令总是会被应用在组件的根节点上。
200198

201199
```vue-html
202200
<my-component v-demo="test"></my-component>
@@ -205,15 +203,13 @@ When used on components, custom directive will always apply to component's root
205203
```js
206204
app.component('my-component', {
207205
template: `
208-
<div> // v-demo directive will be applied here
206+
<div> // v-demo 指令将会被应用在这里
209207
<span>My component content</span>
210208
</div>
211209
`
212210
})
213211
```
214212

215-
<!-- TODO: translation -->
216-
217-
Unlike attributes, directives can't be passed to a different element with `v-bind="$attrs"`.
213+
和 attribute 不同,指令不会通过 `v-bind="$attrs"` 被传入另一个元素。
218214

219-
With [fragments](/guide/migration/fragments.html#overview) support, components can potentially have more than one root nodes. When applied to a multi-root component, directive will be ignored and the warning will be thrown.
215+
有了[片段](/guide/migration/fragments.html#概览)支持以后,组件可能会有多个根节点。当被应用在一个多根节点的组件上时,指令会被忽略,并且会抛出一个警告。

0 commit comments

Comments
 (0)