File tree 1 file changed +9
-9
lines changed 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- title : Props Default Function this Access
2
+ title : プロパティのデフォルト値ファクトリ関数の ` this` アクセス
3
3
badges :
4
4
- breaking
5
5
---
6
6
7
- # Props Default Function ` this ` Access <MigrationBadges :badges =" $frontmatter.badges " />
7
+ # プロパティのデフォルト値ファクトリ関数の ` this ` アクセス <MigrationBadges :badges =" $frontmatter.badges " />
8
8
9
- Props default value factory functions no longer have access to ` this ` .
9
+ プロパティのデフォルト値ファクトリ関数が ` this ` にアクセスできなくなりました。
10
10
11
- Instead:
11
+ 代わりの方法は以下です。
12
12
13
- - Raw props received by the component are passed to the default function as argument;
13
+ - コンポーネントが受け取った生のプロパティは、引数としてデフォルト関数に渡されます。
14
14
15
- - The [ inject] ( ../composition-api-provide-inject.md ) API can be used inside default functions.
15
+ - [ inject] ( ../composition-api-provide-inject.md ) API がデフォルト関数の内部で使用できます。
16
16
17
17
``` js
18
18
import { inject } from ' vue'
@@ -21,9 +21,9 @@ export default {
21
21
props: {
22
22
theme: {
23
23
default (props ) {
24
- // `props` is the raw values passed to the component,
25
- // before any type / default coercions
26
- // can also use `inject` to access injected properties
24
+ // `props` 引数はコンポーネントに渡される生の値で、
25
+ // 型やデフォルトの強制より前のものです。
26
+ // また、 `inject` を使用して注入されたプロパティにアクセスすることもできます。
27
27
return inject (' theme' , ' default-theme' )
28
28
}
29
29
}
You can’t perform that action at this time.
0 commit comments