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] ( https://vuejs.org/api/composition-api-dependency-injection.html#inject ) API can be used inside default functions .
15
+ - API [ inject] ( https://vuejs.org/api/composition-api-dependency-injection.html#inject ) можна використовувати у функціях за замовчуванням .
16
16
17
17
``` js
18
18
import { inject } from ' vue'
@@ -21,16 +21,17 @@ 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
28
return inject (' theme' , ' default-theme' )
28
29
}
29
30
}
30
31
}
31
32
}
32
33
```
33
34
34
- ## Migration Strategy
35
+ ## Стратегія міграції
35
36
36
- [ Migration build flag : ` PROPS_DEFAULT_THIS ` ] ( ../migration-build.html#compat-configuration )
37
+ [ Прапор збірки міграції : ` PROPS_DEFAULT_THIS ` ] ( ../migration-build.html#compat-configuration )
0 commit comments