# 循环节点
用于通过设定循环次数和逻辑,重复执行一系列任务。
# 数据结构定义
# 范例
// loopType 选择列表
[
{
key: 'array',
name: '使用数组循环',
},
{
key: 'count',
name: '指定循环次数',
},
{
key: 'infinite',
name: '无限循环',
},
]
// 节点数据
{
id: {random(6)},
type: 'loop',
data: {
title: `循环`,
inputsValues: {
loopCount: { // 循环次数
type: 'constant',
content: 10,
},
loopFor: { // 循环数组
type: 'ref',
content: [],
},
},
inputs: {
type: 'object',
required: ['loopCount', 'loopFor'],
properties: {
loopCount: {
type: 'number',
},
loopFor: {
type: 'ref',
},
},
},
outputs: {
type: 'object',
properties: {},
},
},
blocks: [
{
id: {random(6)},
type: 'block-start',
meta: {
position: {
x: -80,
y: 120,
},
},
data: {},
},
{
id: {random(6)},
type: 'block-end',
meta: {
position: {
x: 80,
y: 120,
},
},
data: {},
},
],
}