inputs

AMD: require(["geoscene/form/elements/support/inputs"], (inputs) => { /* 代码 */ });
ESM: import * as inputs from "@geoscene/core/form/elements/support/inputs";
对象: geoscene/form/elements/support/inputs
起始版本: GeoScene API for JavaScript 4.22

一个方便的模块,用于在使用 TypeScript 进行开发时导入 esri/form/elements/inputs/Input 类。例如,与其像这样一次导入一个表单元素,不如这样:

import TextAreaInput from "geoscene/form/elements/inputs/TextAreaInput";
import TextBoxInput from "geoscene/form/elements/inputs/TextBoxInput";
import BarcodeScannerInput from "geoscene/form/elements/inputs/BarcodeScannerInput";
import ComboBoxInput from "geoscene/form/elements/inputs/ComboBoxInput";
import RadioButtonsInput from "geoscene/form/elements/inputs/RadioButtonsInput";

您可以使用此模块将它们导入到一行上:

import { TextAreaInput, TextBoxInput, BarcodeScannerInput, ComboBoxInput, RadioButtonsInput } from "geoscene/form/elements/inputs";

此模块还允许您在表单元素输入上实现类型保护,从而使代码更加智能。

import { Input } from "geoscene/form/elements/inputs";

function logFormElementInput(input: Input): void {
  if (input.type === "text-area") {
    console.log("Form element input type is TextAreaInput");
  }
  else {
    // The compiler knows the content element must be an input type such as  `text-area` | `text-box` | `barcode-scanner` | `radio-buttons` | `combo-box`
    console.log("The value is not a valid form element input.")
  }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.