研究调查问卷:请告诉我们您使用 Blockly 的体验
开始调查问卷
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
blockly >输入 >输入
用于包含可选字段的输入的类。
Signature:
export declare class Input
构造函数
属性
方法
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eThe \u003ccode\u003einputs.Input\u003c/code\u003e class in Blockly manages inputs with optional fields for blocks, handling their properties and connections.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to add, remove, and modify fields within the input, as well as control its alignment and visibility.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use this class to customize block inputs by specifying field types, connections, and other attributes.\u003c/p\u003e\n"],["\u003cp\u003eThe class also offers methods to manage connections to other blocks, including setting compatibility and shadow blocks.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [inputs](./blockly.inputs_namespace.md) \\\u003e [Input](./blockly.inputs_namespace.input_class.md)\n\ninputs.Input class\n------------------\n\nClass for an input with optional fields.\n\n**Signature:** \n\n export declare class Input \n\nConstructors\n------------\n\n| Constructor | Modifiers | Description |\n|-----------------------------------------------------------------------------------------------------------|-----------|------------------------------------------------|\n| [(constructor)(name, sourceBlock)](./blockly.inputs_namespace.input_class._constructor__1_constructor.md) | | Constructs a new instance of the `Input` class |\n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|-----------------------------------------------------------------------------|------------|-------------------------------------------------------------|------------------------------------------------------|\n| [align](./blockly.inputs_namespace.input_class.align_property.md) | | [Align](./blockly.inputs_namespace.align_enum.md) | Alignment of input's fields (left, right or centre). |\n| [connection](./blockly.inputs_namespace.input_class.connection_property.md) | | [Connection](./blockly.connection_class.md) \\| null | |\n| [fieldRow](./blockly.inputs_namespace.input_class.fieldrow_property.md) | | [Field](./blockly.field_class.md)\\[\\] | |\n| [name](./blockly.inputs_namespace.input_class.name_property.md) | | string | |\n| [type](./blockly.inputs_namespace.input_class.type_property.md) | `readonly` | [inputTypes](./blockly.inputs_namespace.inputtypes_enum.md) | |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|-----------------------------------------------------------------------------------------------------------|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [appendField(field, opt_name)](./blockly.inputs_namespace.input_class.appendfield_1_method.md) | | Add a field (or label from string), and all prefix and suffix fields, to the end of the input's field row. |\n| [dispose()](./blockly.inputs_namespace.input_class.dispose_1_method.md) | | Sever all links to this input. |\n| [getShadowDom()](./blockly.inputs_namespace.input_class.getshadowdom_1_method.md) | | Returns the XML representation of the connection's shadow block. |\n| [getSourceBlock()](./blockly.inputs_namespace.input_class.getsourceblock_1_method.md) | | Get the source block for this input. |\n| [init()](./blockly.inputs_namespace.input_class.init_1_method.md) | | Initialize the fields on this input. |\n| [insertFieldAt(index, field, opt_name)](./blockly.inputs_namespace.input_class.insertfieldat_1_method.md) | | Inserts a field (or label from string), and all prefix and suffix fields, at the location of the input's field row. |\n| [isVisible()](./blockly.inputs_namespace.input_class.isvisible_1_method.md) | | Gets whether this input is visible or not. |\n| [makeConnection(type)](./blockly.inputs_namespace.input_class.makeconnection_1_method.md) | `protected` | Constructs a connection based on the type of this input's source block. Properly handles constructing headless connections for headless blocks and rendered connections for rendered blocks. |\n| [removeField(name, opt_quiet)](./blockly.inputs_namespace.input_class.removefield_1_method.md) | | Remove a field from this input. |\n| [setAlign(align)](./blockly.inputs_namespace.input_class.setalign_1_method.md) | | Change the alignment of the connection's field(s). |\n| [setCheck(check)](./blockly.inputs_namespace.input_class.setcheck_1_method.md) | | Change a connection's compatibility. |\n| [setShadowDom(shadow)](./blockly.inputs_namespace.input_class.setshadowdom_1_method.md) | | Changes the connection's shadow block. |"]]