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.
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 |
|
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:
|
Rename Iterator | In the tile editor layer bar, you can double-click an iterator to rename the name of the input iterator. |