แชร์ผ่าน


getResource

แสดงทรัพยากร CSS, HTML หรือ img ที่กําหนดไว้ในรายชื่อแฟ้มคอมโพเนนต์

พร้อมใช้งานสําหรับ

แอปแบบจำลอง

ไวยากรณ์

context.resources.getResource(id, success, failure)

พารามิเตอร์

ชื่อพารามิเตอร์ ประเภท ต้องมี คำอธิบาย
id String ใช่ ตัวระบุสตริงของทรัพยากร
ความสําเร็จ function (string) => void ไม่ใช่ การเรียกกลับความสําเร็จ ข้อมูลทรัพยากรจะถูกส่งกลับในรูปแบบการเข้ารหัส 64 ฐาน
ความล้มเหลว function () => void ไม่ใช่ การเรียกกลับความล้มเหลว

ตัวอย่าง

 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();
    }
  }

ทรัพยากร
การอ้างอิง API ของเฟรมเวิร์กคอมโพเนนต์ Power Apps
ภาพรวมเฟรมเวิร์กคอมโพเนนต์ใน Power Apps