跳轉到

取得其他欄位值

在欄位互動中,可以透過欄位的「代號」取得其他欄位的值。

取值動作需由程式主動觸發,無法透過訂閱的方式被動取得更新

使用方法為呼叫 getTargetFieldValue(code),傳入欲取得的欄位代號,回傳值為 Promise<any> 型別。

範例如下:

使用 .then() 方式

onGetValueClick() {
  this.pluginUtils.getTargetFieldValue('C003').then(res => {
    this.fieldValue = res;
  });
}

使用 await 方式。

async onGetValueClick() {
  this.fieldValue = await this.pluginUtils.getTargetFieldValue('C003');
}

回傳值的型別會依照目標欄位的類型而異,可能是 stringboolean、物件等。

除了標準欄位,也可以取得來自外掛欄位的值。

Note

目前尚未提供訂閱機制來偵測目標欄位的值變動,需由開發者自行設計觸發時機。