Skip to content

Commit 4698fb6

Browse files
committed
docs: translate composition api
1 parent 54aa3b1 commit 4698fb6

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/api/composition-api.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Composition API
22

3-
> This section uses [single-file component](../guide/single-file-component.html) syntax for code examples
3+
> このセクションでは、コード例に [単一ファイルコンポーネント](../guide/single-file-component.html) 構文を使用します
44
55
## `setup`
66

7-
A component option that is executed **before** the component is created, once the `props` are resolved. It serves as the entry point for composition APIs.
7+
コンポーネントオプションは、コンポーネントが作成される **前に**`props` が解決されると実行されます。これは Composition API のエントリポイントとなります。
88

9-
- **Arguments:**
9+
- **引数:**
1010

1111
- `{Data} props`
1212
- `{SetupContext} context`
1313

14-
Similar to `this.$props` when using Options API, the `props` object will only contain explicitly declared props. Also, all declared prop keys will be present on the `props` object, regardless of whether it was passed by the parent component or not. Absent optional props will have a value of `undefined`.
14+
オプション API を使うときの `this.$props` と同様に、`props` オブジェクトには明示的に宣言されたプロパティのみが含まれます。また、すべての宣言されたプロパティのキーは、親コンポーネントから渡されたかどうかに関わらず `props` オブジェクトに存在します。宣言されていない省略可能なプロパティは `undefined` という値になります。
1515

1616
If you need to check the absence of an optional prop, you can give it a Symbol as its default value:
1717

@@ -30,7 +30,7 @@ A component option that is executed **before** the component is created, once th
3030
}
3131
```
3232

33-
- **Typing**:
33+
- ****:
3434

3535
```ts
3636
interface Data {
@@ -51,7 +51,7 @@ A component option that is executed **before** the component is created, once th
5151
To get type inference for the arguments passed to `setup()`, the use of [defineComponent](global-api.html#definecomponent) is needed.
5252
:::
5353

54-
- **Example**
54+
- ****
5555

5656
With the template:
5757

@@ -121,9 +121,9 @@ A component option that is executed **before** the component is created, once th
121121
}
122122
```
123123

124-
- **See also**: [Composition API `setup`](../guide/composition-api-setup.html)
124+
- **参照**: [Composition API `setup`](../guide/composition-api-setup.html)
125125

126-
## Lifecycle Hooks
126+
## ライフサイクルフック
127127

128128
Lifecycle hooks can be registered with directly-imported `onX` functions:
129129

@@ -149,10 +149,10 @@ These lifecycle hook registration functions can only be used synchronously durin
149149

150150
The component instance context is also set during the synchronous execution of lifecycle hooks. As a result, watchers and computed properties created synchronously inside of lifecycle hooks are also automatically tore down when the component unmounts.
151151

152-
- **Mapping between Options API Lifecycle Options and Composition API**
152+
- **オプション API のライフサイクルオプションと Composition API のマッピング**
153153

154-
- ~~`beforeCreate`~~ -> use `setup()`
155-
- ~~`created`~~ -> use `setup()`
154+
- ~~`beforeCreate`~~ -> `setup()` を使用
155+
- ~~`created`~~ -> `setup()` を使用
156156
- `beforeMount` -> `onBeforeMount`
157157
- `mounted` -> `onMounted`
158158
- `beforeUpdate` -> `onBeforeUpdate`
@@ -166,13 +166,13 @@ The component instance context is also set during the synchronous execution of l
166166
- `deactivated` -> `onDeactivated`
167167

168168

169-
- **See also**: [Composition API lifecycle hooks](../guide/composition-api-lifecycle-hooks.html)
169+
- **参照**: [Composition API ライフサイクルフック](../guide/composition-api-lifecycle-hooks.html)
170170

171171
## Provide / Inject
172172

173173
`provide` and `inject` enables dependency injection. Both can only be called during [`setup()`](#setup) with a current active instance.
174174

175-
- **Typing**:
175+
- ****:
176176

177177
```ts
178178
interface InjectionKey<T> extends Symbol {}
@@ -209,7 +209,7 @@ The component instance context is also set during the synchronous execution of l
209209
const foo = inject<string>('foo') // string | undefined
210210
```
211211

212-
- **See also**:
212+
- **参照**:
213213
- [Provide / Inject](../guide/component-provide-inject.html)
214214
- [Composition API Provide / Inject](../guide/composition-api-provide-inject.html)
215215

0 commit comments

Comments
 (0)