Skip to content

Commit 8b27194

Browse files
committed
docs: update docs
1 parent 653a2d8 commit 8b27194

File tree

2 files changed

+126
-0
lines changed

2 files changed

+126
-0
lines changed

docs/api/view.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,70 @@ override redraw() {
168168
}
169169
```
170170

171+
## subView()
172+
173+
```
174+
protected subView<T extends ViewConstructor>(
175+
SubView: T,
176+
selector?: string
177+
): InstanceType<T> | null;
178+
```
179+
180+
Returns the first subView created within the `template()` method that matches the constructor passed as an argument. The optional second argument, selector,
181+
182+
allows for further querying conditions using a CSS Selector.
183+
184+
```typescript
185+
class ProductView extends View<Product> {
186+
override template(product: Product) {
187+
return html`
188+
<div>
189+
${new PhotoView({ src: product.thumbnail, alt: product.name })}
190+
<div class="name">${product.name}</div>
191+
<div class="price">$${product.price}</div>
192+
</div>
193+
`;
194+
}
195+
196+
override onRender() {
197+
console.log(this.subView(PhotoView)!.data.src);
198+
}
199+
}
200+
```
201+
202+
## subViews()
203+
204+
```
205+
protected subViews<T extends ViewConstructor>(
206+
SubView: T,
207+
selector?: string
208+
): InstanceType<T>[];
209+
```
210+
211+
Returns an array of subViews.
212+
213+
## subViewIn()
214+
215+
```
216+
protected subViewIn<T extends ViewConstructor>(
217+
selector: string,
218+
SubView: T
219+
): InstanceType<T> | null;
220+
```
221+
222+
Returns a single subView drawn inside a parent element found using the selector.
223+
224+
## subViewsIn()
225+
226+
```
227+
protected subViewsIn<T extends ViewConstructor>(
228+
selector: string,
229+
SubView: T,
230+
): InstanceType<T>[];
231+
```
232+
233+
Returns an array of subViews drawn inside a parent element found using the selector.
234+
171235
## redrawOnlySubViews()
172236

173237
`protected redrawOnlySubViews(): this;`

docs/ko/api/view.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,68 @@ override redraw() {
172172
}
173173
```
174174

175+
## subView()
176+
177+
```
178+
protected subView<T extends ViewConstructor>(
179+
SubView: T,
180+
selector?: string
181+
): InstanceType<T> | null;
182+
```
183+
184+
View의 `template()` 메서드 안에서 생성된 subView들, 즉 첫 번째 뎁스의 subView들 중에 컨스트럭터가 인자로 전달한 컨스트럭터와 동일한 첫 번째 subView를 리턴합니다. 두 번째 인자인 selector? 는 CSS Selector로, SubView를 조회하는 조건을 추가할 수 있습니다.
185+
186+
```typescript
187+
class ProductView extends View<Product> {
188+
override template(product: Product) {
189+
return html`
190+
<div>
191+
${new PhotoView({ src: product.thumbnail, alt: product.name })}
192+
<div class="name">${product.name}</div>
193+
<div class="price">$${product.price}</div>
194+
</div>
195+
`;
196+
}
197+
198+
override onRender() {
199+
console.log(this.subView(PhotoView)!.data.src);
200+
}
201+
}
202+
```
203+
204+
## subViews()
205+
206+
```
207+
protected subViews<T extends ViewConstructor>(
208+
SubView: T,
209+
selector?: string
210+
): InstanceType<T>[];
211+
```
212+
213+
subViews 배열을 리턴합니다.
214+
215+
## subViewIn()
216+
217+
```
218+
protected subViewIn<T extends ViewConstructor>(
219+
selector: string,
220+
SubView: T
221+
): InstanceType<T> | null;
222+
```
223+
224+
selector로 찾아지는 부모 엘리먼트 내부에 그려진 subView를 하나를 리턴합니다.
225+
226+
## subViewsIn()
227+
228+
```
229+
protected subViewsIn<T extends ViewConstructor>(
230+
selector: string,
231+
SubView: T,
232+
): InstanceType<T>[];
233+
```
234+
235+
selector로 찾아지는 부모 엘리먼트 내부에 그려진 subViews 배열을 리턴합니다.
236+
175237
## redrawOnlySubViews()
176238

177239
`protected redrawOnlySubViews(): this;`

0 commit comments

Comments
 (0)