Skip to content

节点基础文件#

¥Node base file

节点基础文件包含节点的核心代码。所有节点都必须包含一个基础文件。此文件的内容会根据你构建的是声明式节点还是程序式节点而有所不同。有关使用哪种风格的指南,请参阅 选择你的节点构建方法

¥The node base file contains the core code of your node. All nodes must have a base file. The contents of this file are different depending on whether you're building a declarative-style or programmatic-style node. For guidance on which style to use, refer to Choose your node building approach.

这些文档提供了简短的代码片段,以帮助你理解代码结构和概念。有关构建节点的完整演练(包括实际代码示例),请参阅 构建声明式风格节点构建程序化风格的节点

¥These documents give short code snippets to help understand the code structure and concepts. For full walk-throughs of building a node, including real-world code examples, refer to Build a declarative-style node or Build a programmatic-style node.

你还可以浏览 n8n-nodes-starter 和 n8n 自带的 nodes,以获取更多示例。入门套件包含你可以基于其构建的基本示例。n8n Mattermost 节点 是一个很好的例子,展示了更复杂的程序化风格节点,包括版本控制。

¥You can also explore the n8n-nodes-starter and n8n's own nodes for a wider range of examples. The starter contains basic examples that you can build on. The n8n Mattermost node is a good example of a more complex programmatic-style node, including versioning.

要使用所有节点,请参阅:

¥For all nodes, refer to the:

¥Structure of the node base file

¥Standard parameters

有关声明式节点,请参阅:

¥For declarative-style nodes, refer to the:

¥Declarative-style parameters

对于程序化风格的节点,请参阅:

¥For programmatic-style nodes, refer to the:

¥Programmatic-style parameters

¥Programmatic-style execute() method