You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 のエントリポイントとなります。
8
8
9
-
-**Arguments:**
9
+
-**引数:**
10
10
11
11
-`{Data} props`
12
12
-`{SetupContext} context`
13
13
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` という値になります。
15
15
16
16
If you need to check the absence of an optional prop, you can give it a Symbol as its default value:
17
17
@@ -30,7 +30,7 @@ A component option that is executed **before** the component is created, once th
30
30
}
31
31
```
32
32
33
-
-**Typing**:
33
+
-**型**:
34
34
35
35
```ts
36
36
interfaceData {
@@ -51,7 +51,7 @@ A component option that is executed **before** the component is created, once th
51
51
Togettypeinference for the arguments passed to `setup()`, the use of [defineComponent](global-api.html#definecomponent) is needed.
52
52
:::
53
53
54
-
-**Example**
54
+
-**例**
55
55
56
56
Withthetemplate:
57
57
@@ -121,9 +121,9 @@ A component option that is executed **before** the component is created, once th
121
121
}
122
122
```
123
123
124
-
-**See also**: [Composition API `setup`](../guide/composition-api-setup.html)
124
+
-**参照**: [Composition API `setup`](../guide/composition-api-setup.html)
125
125
126
-
## Lifecycle Hooks
126
+
## ライフサイクルフック
127
127
128
128
Lifecycle hooks can be registered with directly-imported `onX` functions:
129
129
@@ -149,10 +149,10 @@ These lifecycle hook registration functions can only be used synchronously durin
149
149
150
150
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.
151
151
152
-
-**Mapping between Options API Lifecycle Options and Composition API**
152
+
-**オプション API のライフサイクルオプションと Composition API のマッピング**
153
153
154
-
-~~`beforeCreate`~~ -> use `setup()`
155
-
-~~`created`~~ -> use `setup()`
154
+
-~~`beforeCreate`~~ -> `setup()` を使用
155
+
-~~`created`~~ -> `setup()` を使用
156
156
-`beforeMount` -> `onBeforeMount`
157
157
-`mounted` -> `onMounted`
158
158
-`beforeUpdate` -> `onBeforeUpdate`
@@ -166,13 +166,13 @@ The component instance context is also set during the synchronous execution of l
166
166
-`deactivated` -> `onDeactivated`
167
167
168
168
169
-
-**See also**: [Composition API lifecycle hooks](../guide/composition-api-lifecycle-hooks.html)
169
+
-**参照**: [Composition API ライフサイクルフック](../guide/composition-api-lifecycle-hooks.html)
170
170
171
171
## Provide / Inject
172
172
173
173
`provide` and `inject` enables dependency injection. Both can only be called during [`setup()`](#setup) with a current active instance.
174
174
175
-
-**Typing**:
175
+
-**型**:
176
176
177
177
```ts
178
178
interfaceInjectionKey<T> extendsSymbol {}
@@ -209,7 +209,7 @@ The component instance context is also set during the synchronous execution of l
0 commit comments