使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
blockly >字段 >(构造函数)
Field.(constructor)
构造 Field
类的新实例
Signature:
constructor(value: T | typeof Field.SKIP_SETUP, validator?: FieldValidator<T> | null, config?: FieldConfig);
参数
参数 |
类型 |
说明 |
值 |
T |Field.SKIP_SETUP 的类型 |
字段的初始值。如果您希望跳过设置过程,则也接受 Field.SKIP_SETUP(仅供希望在自己的构造函数运行后处理配置和设置字段值的子类使用)。 |
验证器 |
FieldValidator<T>|null |
(可选)为验证字段值更改而调用的函数。接受价值和返回已验证的值,如果返回 null,则取消更改。 |
config |
FieldConfig |
(可选)用于配置该字段的选项映射。有关此参数支持的属性列表,请参阅具体字段的文档。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-25。"],[],["The `Field` class constructor initializes a new field instance. It accepts three parameters: `value`, `validator`, and `config`. `value` sets the field's initial value or `Field.SKIP_SETUP` for deferred setup. `validator` is an optional function to validate value changes, returning a validated value or null. `config`, also optional, is a map of field-specific configuration options. These parameters enable setting the initial state and defining constraints.\n"]]