傳回元件資訊清單中定義的 CSS、HTML 或 img 資源。
適用於
模型導向應用程式
語法
context.resources.getResource(id, success, failure)
參數
| 參數名稱 | 類型 | 為必填項目 | Description |
|---|---|---|---|
| 識別碼 | String |
Yes | 資源字串識別碼。 |
| 勝 | function (string) => void |
否 | 成功回呼。 資源資料會以基底 64 編碼格式傳回。 |
| 失敗 | function () => void |
否 | 失敗回呼。 |
Example
private setDefaultImage(): void {
this._context.resources.getResource(
DefaultImageFileName,
this.setImage.bind(this, false, "png"),
this.showError.bind(this)
);
this.controlContainer.classList.add(NoImageClassName);
// If it already has value, we need to update the output
if (this._context.parameters.value.raw) {
this._value = null;
this._notifyOutputChanged();
}
}