Skip to content

Commit dec2d46

Browse files
committed
docs: translate api references > option > composition
1 parent b077f96 commit dec2d46

File tree

2 files changed

+70
-67
lines changed

2 files changed

+70
-67
lines changed

src/api/options-assets.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Assets
1+
# アセット
22

33
## directives
44

5-
- **Type:** `Object`
5+
- **:** `Object`
66

7-
- **Details:**
7+
- **詳細:**
88

9-
A hash of directives to be made available to the component instance.
9+
そのコンポーネントインスタンスで利用可能なディレクティブのハッシュです。
1010

11-
- **Usage:**
11+
- **使用方法:**
1212

1313
```js
1414
const app = createApp({})
@@ -21,21 +21,24 @@
2121
}
2222
}
2323
},
24+
2425
template: `<input v-focus>`
2526
})
2627
```
2728

28-
- **See also:** [Custom Directives](../guide/custom-directive.html)
29+
- **参照:** [カスタムディレクティブ](../guide/custom-directive.html)
2930

3031
## components
3132

32-
- **Type:** `Object`
33+
- **型:** `Object`
34+
35+
- **詳細:**
36+
37+
そのコンポーネントインスタンスで利用可能なコンポーネントのハッシュです
3338

34-
- **Details:**
3539

36-
A hash of components to be made available to the component instance.
3740

38-
- **Usage:**
41+
- **使用方法:**
3942

4043
```js
4144
const Foo = {
@@ -50,4 +53,4 @@
5053
})
5154
```
5255

53-
- **See also:** [Components](../guide/component-basics.html)
56+
- **参照:** [コンポーネント](../guide/component-basics.html)

src/api/options-composition.md

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
## mixins
44

5-
- **Type:** `Array<Object>`
5+
- **:** `Array<Object>`
66

7-
- **Details:**
7+
- **詳細:**
88

9-
The `mixins` option accepts an array of mixin objects. These mixin objects can contain instance options like normal instance objects, and they will be merged against the eventual options using the certain option merging logic. For example, if your mixin contains a `created` hook and the component itself also has one, both functions will be called.
9+
`mixins` オプションは、ミックスインオブジェクトの配列を受け入れます。これらのミックスインオブジェクトは、通常のインスタンスオブジェクトと同じようにインスタンスオプションを含めることができ、それらは一定のオプションをマージするロジックを使って、最終的なオプションに対してマージされます。例えば、あなたのミックスインが `created` フックを含み、コンポーネントそれ自身にも `created` フックがある場合、両方の関数が呼び出されます。
1010

11-
Mixin hooks are called in the order they are provided, and called before the component's own hooks.
11+
ミックスインフックは提供された順番に呼び出され、コンポーネント自身のフックよりも前に呼び出されます。
1212

13-
- **Example:**
13+
- **:**
1414

1515
```js
1616
const mixin = {
@@ -30,24 +30,24 @@
3030
// => 2
3131
```
3232

33-
- **See also:** [Mixins](../guide/mixins.html)
33+
- **参照:** [ミックスイン](../guide/mixins.html)
3434

3535
## extends
3636

37-
- **Type:** `Object | Function`
37+
- **:** `Object | Function`
3838

39-
- **Details:**
39+
- **詳細:**
4040

41-
Allows declaratively extending another component (could be either a plain options object or a constructor). This is primarily intended to make it easier to extend between single file components.
41+
別のコンポーネントを宣言的に拡張できます(純粋なオプションオブジェクトまたはコンストラクタのどちらでも)。これは主に単一ファイルコンポーネント間の拡張を簡単にすることを目的としています。
4242

43-
This is similar to `mixins`.
43+
これは `mixins` に似ています。
4444

45-
- **Example:**
45+
- **:**
4646

4747
```js
4848
const CompA = { ... }
4949

50-
// extend CompA without having to call `Vue.extend` on either
50+
// CompA `Vue.extend` の呼び出しなしで拡張します
5151
const CompB = {
5252
extends: CompA,
5353
...
@@ -56,40 +56,40 @@
5656

5757
## provide / inject
5858

59-
- **Type:**
59+
- **:**
6060

6161
- **provide:** `Object | () => Object`
6262
- **inject:** `Array<string> | { [key: string]: string | Symbol | Object }`
6363

64-
- **Details:**
64+
- **詳細:**
6565

66-
This pair of options are used together to allow an ancestor component to serve as a dependency injector for all its descendants, regardless of how deep the component hierarchy is, as long as they are in the same parent chain. If you are familiar with React, this is very similar to React's `context` feature.
66+
この一組のオプションを一緒に使うことで、コンポーネント階層の深さに関わらず、それらが同じ親チェーンにある限り、祖先のコンポーネントがその子孫コンポーネントすべての依存オブジェクトの注入役として機能することができます。React に慣れている方には、これは React`context` の機能と非常によく似ています。
6767

68-
The `provide` option should be an object or a function that returns an object. This object contains the properties that are available for injection into its descendants. You can use ES2015 Symbols as keys in this object, but only in environments that natively support `Symbol` and `Reflect.ownKeys`.
68+
`provide` オプションは、オブジェクトまたはオブジェクトを返す関数でなければなりません。このオブジェクトは、その子孫に注入可能なプロパティを含みます。このオブジェクトのキーには ES2015 の Symbol を使うことができますが、ネイティブで `Symbol` `Reflect.ownKeys` をサポートしている環境でのみ有効です。
6969

70-
The `inject` option should be either:
70+
`inject` オプションは、次のいずれかでなければなりません:
7171

72-
- an array of strings, or
73-
- an object where the keys are the local binding name and the value is either:
74-
- the key (string or Symbol) to search for in available injections, or
75-
- an object where:
76-
- the `from` property is the key (string or Symbol) to search for in available injections, and
77-
- the `default` property is used as fallback value
72+
- 文字列の配列、もしくは
73+
- キーがローカルのバインディング名で、値が次のいずれかであるオブジェクト:
74+
- 利用可能な注入オブジェクトを検索するためのキー(文字列または Symbol)、または
75+
- オブジェクトが:
76+
- `from` プロパティは利用可能な注入オブジェクトを検索するためのキー(文字列または Symbol)、そして
77+
- `default` プロパティはフォールバック値として使われます
7878

79-
> Note: the `provide` and `inject` bindings are NOT reactive. This is intentional. However, if you pass down a reactive object, properties on that object do remain reactive.
79+
> 注意: `provide` `inject` のバインディングはリアクティブではありません。これは意図的なものです。ただし、あなたがリアクティブなオブジェクトを渡した場合、そのオブジェクトのプロパティはリアクティブなままです。
8080
81-
- **Example:**
81+
- **:**
8282

8383
```js
84-
// parent component providing 'foo'
84+
// 'foo' を提供している親コンポーネント
8585
const Provider = {
8686
provide: {
8787
foo: 'bar'
8888
}
8989
// ...
9090
}
9191

92-
// child component injecting 'foo'
92+
// 'foo' を注入している子コンポーネント
9393
const Child = {
9494
inject: ['foo'],
9595
created() {
@@ -99,7 +99,7 @@
9999
}
100100
```
101101

102-
With ES2015 Symbols, function `provide` and object `inject`:
102+
ES2015 の Symbol で、`provide` 関数と `inject` オブジェクトを使います:
103103

104104
```js
105105
const s = Symbol()
@@ -118,7 +118,7 @@
118118
}
119119
```
120120

121-
Using an injected value as the default for a prop:
121+
注入された値をプロパティのデフォルトとして使います:
122122

123123
```js
124124
const Child = {
@@ -133,7 +133,7 @@
133133
}
134134
```
135135

136-
Using an injected value as data entry:
136+
注入された値をデータプロパティの登録に使います:
137137

138138
```js
139139
const Child = {
@@ -146,7 +146,7 @@
146146
}
147147
```
148148

149-
Injections can be optional with default value:
149+
注入はデフォルト値で任意にできます:
150150

151151
```js
152152
const Child = {
@@ -156,7 +156,7 @@
156156
}
157157
```
158158

159-
If it needs to be injected from a property with a different name, use `from` to denote the source property:
159+
別の名前のプロパティから注入する必要がある場合は、`from` を使って元のプロパティを指定します:
160160

161161
```js
162162
const Child = {
@@ -169,7 +169,7 @@
169169
}
170170
```
171171

172-
Similar to prop defaults, you need to use a factory function for non-primitive values:
172+
プロパティのデフォルトと同じように、プリミティブ値以外はファクトリ関数を使う必要があります:
173173

174174
```js
175175
const Child = {
@@ -182,21 +182,21 @@
182182
}
183183
```
184184

185-
- **See also:** [Provide / Inject](../guide/component-provide-inject.html)
185+
- **参照:** [Provide / Inject](../guide/component-provide-inject.html)
186186

187187
## setup
188188

189-
- **Type:** `Function`
189+
- **:** `Function`
190190

191-
The `setup` function is a new component option. It serves as the entry point for using the Composition API inside components.
191+
`setup` 関数は、新しいコンポーネントオプションです。この関数は、コンポーネント内で Composition API を使うためのエントリポイントになります。
192192

193-
- **Invocation Timing**
193+
- **呼び出しのタイミング**
194194

195-
`setup` is called right after the initial props resolution when a component instance is created. Lifecycle-wise, it is called before the [beforeCreate](./options-lifecycle-hooks.html#beforecreate) hook.
195+
`setup` は、コンポーネントインスタンスが作成されたとき、初期プロパティの解決の直後に呼び出されます。ライフサイクル的には、[beforeCreate](./options-lifecycle-hooks.html#beforecreate) フックの前に呼び出されます。
196196

197-
- **Usage with Templates**
197+
- **テンプレートでの利用**
198198

199-
If `setup` returns an object, the properties on the object will be merged on to the render context for the component's template:
199+
`setup` がオブジェクトを返す場合、そのオブジェクトのプロパティはコンポーネントのテンプレートのレンダリングコンテキストにマージされます:
200200

201201
```html
202202
<template>
@@ -221,11 +221,11 @@ The `setup` function is a new component option. It serves as the entry point for
221221
</script>
222222
```
223223

224-
Note that [refs](refs-api.html#ref) returned from `setup` are automatically unwrapped when accessed in the template so there's no need for `.value` in templates.
224+
`setup` から返された [refs](refs-api.html#ref) は、テンプレート内でアクセスする時に自動的にアンラップされるので、テンプレートで `.value` を使う必要はありません。
225225

226-
- **Usage with Render Functions / JSX**
226+
- **Render 関数 / JSX での利用**
227227

228-
`setup` can also return a render function, which can directly make use of reactive state declared in the same scope:
228+
`setup` は、同じスコープで宣言されたリアクティブな状態を直接使える Render 関数を返すこともできます:
229229

230230
```js
231231
import { h, ref, reactive } from 'vue'
@@ -240,9 +240,9 @@ The `setup` function is a new component option. It serves as the entry point for
240240
}
241241
```
242242

243-
- **Arguments**
243+
- **引数**
244244

245-
The function receives the resolved props as its first argument:
245+
この関数は、その第 1 引数として解決されたプロパティを受け取ります:
246246

247247
```js
248248
export default {
@@ -255,7 +255,7 @@ The `setup` function is a new component option. It serves as the entry point for
255255
}
256256
```
257257

258-
Note this `props` object is reactive - i.e. it is updated when new props are passed in, and can be observed and reacted upon using `watchEffect` or `watch`:
258+
この `props` オブジェクトはリアクティブです。つまり、新しいプロパティが渡されると更新され、`watchEffect` `watch` を使って監視と反応をすることができます:
259259

260260
```js
261261
export default {
@@ -270,7 +270,7 @@ The `setup` function is a new component option. It serves as the entry point for
270270
}
271271
```
272272

273-
However, do NOT destructure the `props` object, as it will lose reactivity:
273+
しかし、`props` オブジェクトのリアクティビティが失われるため、そのオブジェクトを分割してはいけません:
274274

275275
```js
276276
export default {
@@ -285,9 +285,9 @@ The `setup` function is a new component option. It serves as the entry point for
285285
}
286286
```
287287

288-
The `props` object is immutable for userland code during development (will emit warning if user code attempts to mutate it).
288+
`props` オブジェクトは、開発中のユーザランドのコードにとってはイミュータブルです(ユーザのコードがそれを変更しようとすると警告を表示します)。
289289

290-
The second argument provides a context object which exposes a selective list of properties that were previously exposed on `this`:
290+
第 2 引数は、`this` で以前に公開されていたプロパティの選択的な一覧を公開するコンテキストオブジェクトを提供します:
291291

292292
```js
293293
const MyComponent = {
@@ -299,23 +299,23 @@ The `setup` function is a new component option. It serves as the entry point for
299299
}
300300
```
301301

302-
`attrs` and `slots` are proxies to the corresponding values on the internal component instance. This ensures they always expose the latest values even after updates so that we can destructure them without worrying about accessing a stale reference:
302+
`attrs` `slots` は内部コンポーネントインスタンスの対応する値へのプロキシです。これは更新後も常に最新の値が公開されることを保証するので、古くなった参照へのアクセスを心配することなく、構造を変更することができます:
303303

304304
```js
305305
const MyComponent = {
306306
setup(props, { attrs }) {
307-
// a function that may get called at a later stage
307+
// 後の段階で呼び出されるはずの関数
308308
function onClick() {
309-
console.log(attrs.foo) // guaranteed to be the latest reference
309+
console.log(attrs.foo) // 最新の参照が保証されている
310310
}
311311
}
312312
}
313313
```
314314

315-
There are a number of reasons for placing `props` as a separate first argument instead of including it in the context:
315+
`props` がコンテキストに含まれる代わりに、別の第 1 引数として置かれている理由はいくつかあります:
316316

317-
- It's much more common for a component to use `props` than the other properties, and very often a component uses only `props`.
317+
- コンポーネントが `props` を使うことが、他のプロパティよりもずっと一般的であること、そしてコンポーネントが `props` のみを扱うことがとても頻繁にあることです。
318318

319-
- Having `props` as a separate argument makes it easier to type it individually without messing up the types of other properties on the context. It also makes it possible to keep a consistent signature across `setup`, `render` and plain functional components with TSX support.
319+
- `props` を別の引数として持つことで、コンテキストの他のプロパティの型を混乱させることなく、個別に入力することが楽になります。また TSX のサポートで `setup``render`、単純な関数コンポーネントを通して、一貫した定義を守ることができます。
320320

321-
- **See also:** [Composition API](composition-api.html)
321+
- **参照:** [Composition API](composition-api.html)

0 commit comments

Comments
 (0)