구성 요소 매니페스트에 정의된 CSS, HTML 또는 img 리소스를 반환합니다.
사용할 수 있는 대상
모델 기반 앱
Syntax
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();
}
}