Skip to content

Commit de5b8b3

Browse files
committed
docs: translate custom directives
1 parent e470e7b commit de5b8b3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/guide/custom-directive.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ directives: {
4545

4646
ディレクティブの定義オブジェクトは、いくつかのフック関数を提供しています (全てオプション):
4747

48-
- `created`: called before the bound element's attributes or event listeners are applied. This is useful in cases where the directive needs to attach event listeners that must be called before normal `v-on` event listeners.
48+
- `created`: 束縛された要素の属性や、イベントリスナが適用される前に呼ばれます。これは通常の `v-on` イベントリスナの前に呼ばれなければならないイベントリスナをつける必要がある場合に便利です。
4949

50-
- `beforeMount`: called when the directive is first bound to the element and before parent component is mounted.
50+
- `beforeMount`: ディレクティブが最初に要素に束縛されたとき、親コンポーネントがマウントされる前に呼ばれます。
5151

5252
- `mounted`: 束縛された要素の親コンポーネントがマウントされた時に呼ばれます。
5353

@@ -169,7 +169,7 @@ app.directive('pin', {
169169

170170
## 関数による省略記法
171171

172-
前回の例では`mounted``updated` に同じ振る舞いを欲しかったでしょう。しかし、その他のフック関数を気にしてはいけません。ディレクティブにコールバックを渡すことで実現できます:
172+
前の例では`mounted``updated` に同じ振る舞いをさせたいが、その他のフックは気にしない、という場合があります。そのような場合は、ディレクティブにコールバックを渡すことで実現できます:
173173

174174
```js
175175
app.directive('pin', (el, binding) => {
@@ -194,9 +194,9 @@ app.directive('demo', (el, binding) => {
194194
})
195195
```
196196

197-
## コンポーネントにおける使用法
197+
## コンポーネントでの使い方
198198

199-
When used on components, custom directive will always apply to component's root node, similarly to [non-prop attributes](component-attrs.html).
199+
コンポーネントに使われた場合、カスタムディレクティブは [プロパティでない属性](component-attrs.html) と同じように、常にコンポーネントのルートノードに適用されます
200200

201201
```vue-html
202202
<my-component v-demo="test"></my-component>
@@ -205,13 +205,13 @@ When used on components, custom directive will always apply to component's root
205205
```js
206206
app.component('my-component', {
207207
template: `
208-
<div> // v-demo directive will be applied here
208+
<div> // v-demo ディレクティブはここで適用される
209209
<span>My component content</span>
210210
</div>
211211
`
212212
})
213213
```
214214

215-
Unlike attributes, directives can't be passed to a different element with `v-bind="$attrs"`.
215+
属性とは異なり、ディレクティブは `v-bind="$attrs"` で別の要素に渡すことはできません。
216216

217-
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.
217+
[Fragments](/guide/migration/fragments.html#overview) のサポートによって、コンポーネントは複数のルートノードを持つことができます。マルチルートコンポーネントに適用された場合、ディレクティブは無視され、警告が投げられます。

0 commit comments

Comments
 (0)