根據傳入的屬性類型傳回格式化程式使用者輸入。 如果無法辨識類型,則傳回輸入本身。
語法
context.formatting.formatUserInput(input, controlAttributes);
適用於
模型導向和畫布應用程式
參數
| 參數名稱 | 類型 | 為必填項目 | Description |
|---|---|---|---|
| 輸入 | unknown |
Yes | 使用者輸入。 |
| 行為 | ControlAttributes |
Yes |
controlAttributes 由格式化程式使用。 |
傳回值
類型: string
Example
const controlAttributes = {
Type: "double",
Precision: 2,
PrecisionSource: 0,
Behavior: null,
OptionSet: null,
Format: null,
} as ControlAttributes;
context.formatter.formatUserInput("22", controlAttributes);