程序化参数(Programmatic-style parameters)#
这些是用于程序化风格节点的 节点基础文件 可用的参数。
🌐 These are the parameters available for node base file of programmatic-style nodes.
本文件提供了一些简短的代码片段,以帮助理解代码结构和概念。有关构建节点的完整演练,包括实际的代码示例,请参阅 构建程序化风格节点。
🌐 This document gives short code snippets to help understand the code structure and concepts. For a full walk-through of building a node, including real-world code examples, refer to Build a programmatic-style node.
编程风格的节点也使用 execute() 方法。有关更多信息,请参阅 编程风格执行方法。
🌐 Programmatic-style nodes also use the execute() method. Refer to Programmatic-style execute method for more information.
请参阅标准参数以了解适用于所有节点的参数。
🌐 Refer to Standard parameters for parameters available to all nodes.
defaultVersion#
数字 | 可选
🌐 Number | Optional
在使用完整版本控制方法时使用 defaultVersion。
🌐 Use defaultVersion when using the full versioning approach.
n8n 支持两种节点版本控制的方法。更多信息请参阅 节点版本控制。
🌐 n8n support two methods of node versioning. Refer to Node versioning for more information.
methods 和 loadOptions(methods and loadOptions)#
对象 | 可选
🌐 Object | Optional
包含用于编程风格节点的 loadOptions 方法。你可以使用此方法查询服务以获取用户特定的设置(例如从 Gmail 获取用户的电子邮件标签),然后返回它们并在 GUI 中呈现,以便用户可以在后续查询中使用这些设置。
🌐 Contains the loadOptions method for programmatic-style nodes. You can use this method to query the service to get user-specific settings (such as getting a user's email labels from Gmail), then return them and render them in the GUI so the user can include them in subsequent queries.
例如,n8n 的 Gmail 节点 使用 loadOptions 来获取所有邮件标签:
🌐 For example, n8n's Gmail node uses loadOptions to get all email labels:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
version#
数字 或 数组 | 可选
🌐 Number or Array | Optional
在使用轻量版本控制方法时使用 version。
🌐 Use version when using the light versioning approach.
如果你只有一个版本的节点,这可以是一个数字。如果你想支持多个版本,可以将其改为数组,包含每个节点版本的数字。
🌐 If you have one version of your node, this can be a number. If you want to support multiple versions, turn this into an array, containing numbers for each node version.
n8n 支持两种节点版本管理方法。编程风格的节点可以使用其中任意一种。有关更多信息,请参阅 节点版本管理。
🌐 n8n support two methods of node versioning. Programmatic-style nodes can use either. Refer to Node versioning for more information.