iterator-features

更新时间:
复制 MD 格式

An iterator is a list generator. In the block editor panel, you can add a unit template (that is, a group) composed of one or more components, and then generate a list through the data-driven iterator. The number of list items is the same as the length of the array in the iterator data. This topic describes the features and operations of iterators.

An iterator is a list generator. Each item in the list is called an iteration unit. The type and layout of components in the unit are the same as those in the unit template. The data for the components in a cell can be driven by its own data source or obtained from an iterator.

Important

The first-level sublayer of an iterator can only be an iteration unit, not a common component. A common component is included in an iteration unit.

Iterator function operation

Operation

Procedure

Generate iterators

  1. In the block editor, click one or more widgets in the Widgets section to add widgets to the canvas. You can group the widgets.

  2. Select one or more widgets and groups. Right-click the widgets and select Generate Iterator. The selected widgets are automatically wrapped in the iterator to generate an iteration unit.

Add a component to an iterator

In the Layer panel of the Block Editor, select a component that is not wrapped in an iterator and drag the component layer to the iterator to add a component to the iterator.

Remove a component from an iterator

In the Layer panel of the tile editor, select a component wrapped in an iterator and drag the component to a layer outside the iterator to delete a component from the iterator.

Getting data from an iterator

The iterator data response result should be a complex array type, and each item of data in the array can be passed inward to the child component. According to the proximity principle, the component in the iterator can obtain the unit data item of the nearest parent iterator, pass through the component filter, and obtain the final response result.

To obtain data from an iterator, perform the following steps:

  1. Select an iterator component. The Data Source Configuration panel of the component is displayed.

  2. In the Configure Data Source panel, click the Data Source Type drop-down list and select Obtain Data Source from Iterator.

Rename Iterator

In the tile editor layer bar, you can double-click an iterator to rename the name of the input iterator.