구성 요소 인스턴스를 초기화하는 데 사용됩니다. 구성 요소는 원격 서버 호출 및 기타 초기화 작업을 시작할 수 있습니다. 데이터 세트 값은 여기에서 초기화할 수 없습니다. updateView 메서드를 사용하여 이를 달성합니다.
trackContainerResize 는 구성 요소에 레이아웃 정보가 필요하다는 것을 알리기 위해 구성 요소 init 메서드에서 한 번 호출해야 합니다. 이 메서드를 사용하여 프레임워크에 채워 allocatedHeight 지도록 지시하고 allocatedWidth 메서드를 입력합니다.
비고
tractContainerResize를 먼저 allocatedHeight 호출해야 합니다.allocatedWidth
사용할 수 있는 대상
모델 기반 앱, 캔버스 앱 및 포털.
Syntax
init(context,notifyOutputChanged,state,container)
매개 변수
| 매개 변수 이름 | 유형 | 필수 | Description |
|---|---|---|---|
| context | 컨텍스트 | yes | 매개 변수, 구성 요소 메타데이터 및 인터페이스 함수를 포함하는 입력 속성 입니다. |
| notifyOutputChanged | function |
no | 프레임워크에 새 출력이 있음을 알리는 메서드 |
| 주 | Dictionary |
no | 마지막 세션의 setControlState 에서 저장된 구성 요소 상태입니다. |
| container | HTMLDivElement | no | 렌더링할 div 요소 |
Example
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container:HTMLDivElement)
{
this._labelElement = document.createElement("label");
this._labelElement.setAttribute("class", "HelloWorldColor");
container.appendChild(this._labelElement);
}