Skip to content

Commit fdfede8

Browse files
authored
options-composition.md 문서 번역
options-composition.md 번역
1 parent c6c9cb9 commit fdfede8

File tree

1 file changed

+34
-37
lines changed

1 file changed

+34
-37
lines changed

ko-KR/src/api/options-composition.md

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
:::warning 현재 이 문서는 번역 작업이 진행중입니다
2-
:::
3-
41
# Options: Composition
52

63
## provide
74

8-
Provide values that can be injected by descendent components.
5+
하위 컴포넌트에 주입할 수 있는 값을 제공합니다.
96

107
- **타입**:
118

@@ -17,13 +14,13 @@ Provide values that can be injected by descendent components.
1714

1815
- **세부 사항**:
1916

20-
`provide` and [`inject`](#inject) 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.
17+
`provide` [`inject`](#inject) 는 동일한 상위 체인에 있는 컴포넌트 계층 구조의 깊이에 관계없이 모든 하위 컴포넌트에 대한 의존성 주입기 역할을 할 수 있도록 사용됩니다.
2118

22-
The `provide` option should be either 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 Symbols as keys in this object.
19+
`provide` 옵션은 객체 또는 객체를 반환하는 함수여야 합니다. 이 객체에는 하위 컴포넌트에 주입할 수 있는 속성이 포함되어 있습니다. 이 객체에는 Symbol을 키값으로 사용할 수 있습니다.
2320

2421
- **예제**:
2522

26-
Basic usage:
23+
기본 사용법:
2724

2825
```js
2926
const s = Symbol()
@@ -36,15 +33,15 @@ Provide values that can be injected by descendent components.
3633
}
3734
```
3835

39-
Using a function to provide per-component state:
36+
함수를 사용하여 컴포넌트별 상태 제공:
4037

4138
```js
4239
export default {
4340
data() {
4441
return {
4542
msg: 'foo'
4643
}
47-
}
44+
},
4845
provide() {
4946
return {
5047
msg: this.msg
@@ -53,13 +50,13 @@ Provide values that can be injected by descendent components.
5350
}
5451
```
5552

56-
Note in the above example, the provided `msg` will NOT be reactive. See [Working with Reactivity](/guide/components/provide-inject.html#working-with-reactivity) for more details.
53+
위 예시에서 제공된 `msg` 반응형(reactive)이 아닙니다. 자세한 내용은 [Working with Reactivity](/guide/components/provide-inject.html#working-with-reactivity)을 참조하십시오.
5754

5855
- **참고**: [Provide / Inject](/guide/components/provide-inject.html)
5956

6057
## inject
6158

62-
Declare properties to inject into the current component by locating them from ancestor providers.
59+
조상 제공자(Provider)로부터 속성을 찾아 현재 컴포넌트에 주입할 속성을 선언합니다.
6360

6461
- **타입**:
6562

@@ -80,22 +77,22 @@ Declare properties to inject into the current component by locating them from an
8077
8178
- **세부 사항**:
8279
83-
The `inject` option should be either:
80+
`inject` 옵션은 다음 중 하나여야 합니다:
8481
85-
- An array of strings, or
86-
- An object where the keys are the local binding name and the value is either:
87-
- The key (string or Symbol) to search for in available injections, or
88-
- An object where:
89-
- The `from` property is the key (string or Symbol) to search for in available injections, and
90-
- The `default` property is used as fallback value. Similar to props default values, a factory function is needed for object types to avoid value sharing between multiple component instances.
82+
- 문자열 배열 또는
83+
- 객체의 키가 로컬 바인딩 이름이고 값이 다음 중 하나여야 합니다:
84+
- 사용 가능한 주입에서 검색할 키(문자열 또는 심볼) 또는
85+
- 객체:
86+
- `from` 속성은 사용 가능한 주입에서 검색할 키(문자열 또는 심볼)이며,
87+
- `default` 속성은 대체 값으로 사용됩니다. props 기본값과 유사하게 여러 컴포넌트 인스턴스 간의 값 공유를 피하기 위해 객체 유형에 팩토리 함수가 필요합니다.
9188
92-
An injected property will be `undefined` if neither a matching property nor a default value was provided.
89+
일치하는 속성이나 기본값이 제공되지 않은 경우 주입된 속성은 `undefined`가 됩니다.
9390
94-
Note that injected bindings are NOT reactive. This is intentional. However, if the injected value is a reactive object, properties on that object do remain reactive. See [Working with Reactivity](/guide/components/provide-inject.html#working-with-reactivity) for more details.
91+
주입된 바인딩은 반응형(reactive)이 아닙니다. 이것은 의도적입니다. 그러나 주입된 값이 반응형 객체인 경우 해당 객체의 속성은 반응형으로 유지됩니다. 자세한 내용은 [Working with Reactivity](/guide/components/provide-inject.html#working-with-reactivity)을 참조하세요.
9592
9693
- **예제**:
9794
98-
Basic usage:
95+
기본 사용법:
9996
10097
```js
10198
export default {
@@ -106,7 +103,7 @@ Declare properties to inject into the current component by locating them from an
106103
}
107104
```
108105

109-
Using an injected value as the default for a prop:
106+
prop의 기본값으로 주입된 값 사용하기:
110107

111108
```js
112109
const Child = {
@@ -121,7 +118,7 @@ Declare properties to inject into the current component by locating them from an
121118
}
122119
```
123120

124-
Using an injected value as data entry:
121+
주입된 값을 데이터 입력으로 사용:
125122

126123
```js
127124
const Child = {
@@ -133,8 +130,8 @@ Declare properties to inject into the current component by locating them from an
133130
}
134131
}
135132
```
136-
137-
Injections can be optional with default value:
133+
134+
주입은 기본값 설정 옵션을 제공합니다:
138135

139136
```js
140137
const Child = {
@@ -144,7 +141,7 @@ Declare properties to inject into the current component by locating them from an
144141
}
145142
```
146143

147-
If it needs to be injected from a property with a different name, use `from` to denote the source property:
144+
다른 이름의 속성에서 주입해야 하는 경우 `from`을 사용하여 소스 속성을 나타냅니다:
148145

149146
```js
150147
const Child = {
@@ -157,7 +154,7 @@ Declare properties to inject into the current component by locating them from an
157154
}
158155
```
159156

160-
Similar to prop defaults, you need to use a factory function for non-primitive values:
157+
prop 기본값과 유사하게 레퍼런스 값에 대해 팩토리 함수를 사용해야 합니다:
161158

162159
```js
163160
const Child = {
@@ -174,7 +171,7 @@ Declare properties to inject into the current component by locating them from an
174171

175172
## mixins
176173

177-
An array of option objects to be mixed into the current component.
174+
현재 컴포넌트에 혼합할 옵션 객체의 배열입니다.
178175

179176
- **타입**:
180177

@@ -186,12 +183,12 @@ An array of option objects to be mixed into the current component.
186183

187184
- **세부 사항**:
188185

189-
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.
186+
`mixins` 옵션은 mixin 객체의 배열을 허용합니다. 이러한 믹스인 객체는 일반 인스턴스 객체와 같은 인스턴스 옵션을 포함할 수 있으며 특정 옵션 병합 논리를 사용하여 최종 옵션에 대해 병합됩니다. 예를 들어 믹스인에 `created` 훅이 있고 컴포넌트 자체에도 훅이 있는 경우 두 함수가 모두 호출됩니다.
190187

191-
Mixin hooks are called in the order they are provided, and called before the component's own hooks.
188+
믹스인 훅은 제공된 순서대로 호출되며 컴포넌트 자체 훅보다 먼저 호출됩니다.
192189

193-
:::warning No Longer Recommended
194-
In Vue 2, mixins were the primary mechanism for creating reusable chunks of component logic. While mixins continue to be supported in Vue 3, [Composition API](/guide/reusability/composables.html) is now the preferred approach for code reuse between components.
190+
:::warning 더 이상 권장되지 않습니다.
191+
Vue2 에서, 믹스인은 컴포넌트 로직의 재사용 가능한 청크를 생성하기 위한 기본 메커니즘이었습니다. 믹스인은 Vue3 에서 계속 지원되지만, [Composition API](/guide/reusability/composables.html) 를 활용하여 컴포넌트 코드 재사용하는 방식이 선호되고 권장하고 있습니다.
195192
:::
196193

197194
- **예제**:
@@ -216,7 +213,7 @@ An array of option objects to be mixed into the current component.
216213

217214
## extends
218215

219-
A "base class" component to extend from.
216+
확장할 "기본 클래스" 컴포넌트 입니다.
220217

221218
- **타입**:
222219

@@ -228,13 +225,13 @@ A "base class" component to extend from.
228225

229226
- **세부 사항**:
230227

231-
Allows one component to extend another, inheriting its component options.
228+
한 컴포넌트가 다른 컴포넌트를 확장하여 해당 컴포넌트 옵션을 상속할 수 있습니다.
232229

233-
From an implementation perspective, `extends` is almost identical to `mixins`. The component specified by `extends` will be treated as though it were the first mixin.
230+
구현의 관점에서 `extens``mixins`와 거의 동일합니다. `extends`로 지정된 컴포넌트는 첫 번째 믹스인인 것처럼 처리됩니다.
234231

235-
However, `extends` and `mixins` express different intents. The `mixins` option is primarily used to compose chunks of functionality, whereas `extends` is primarily concerned with inheritance.
232+
그러나, `extends``mixins`는 다른 의도를 표현합니다. `mixins` 옵션은 주로 기능 덩어리를 구성하는 데 사용되는 반면, `extends`는 주로 상속과 관련이 있습니다.
236233

237-
As with `mixins`, any options will be merged using the relevant merge strategy.
234+
`mixins`와 마찬가지로 모든 옵션은 관련 병합 전략을 사용하여 병합됩니다.
238235

239236
- **예제**:
240237

0 commit comments

Comments
 (0)