用來初始化元件實例。 元件可以啟動遠端伺服器呼叫和其他初始化動作。 此處無法初始化資料集值,請使用 updateView 方法來實現。
trackContainerResize 應該呼叫一次,最好是在元件 init 方法中,以通知元件需要版面配置資訊。 使用此方法告訴架構要填入 allocatedHeight 和 allocatedWidth 方法。
備註
tractContainerResize 應該先呼叫 and allocatedWidth 方法。allocatedHeight
適用於
模型導向應用程式、畫布應用程式和入口網站。
語法
init(context,notifyOutputChanged,state,container)
參數
| 參數名稱 | 類型 | 為必填項目 | Description |
|---|---|---|---|
| 內容 | 內容 | yes | 輸入 屬性 包含參數、元件中繼資料和介面函式。 |
| notifyOutputChanged | function |
no | 通知架構有新輸出的方法 |
| 狀態 | Dictionary |
no | 在最後一個工作階段中從 setControlState 儲存的元件狀態 |
| 容器 | HTMLDiv元素 | 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);
}