> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qomicex.top/llms.txt
> Use this file to discover all available pages before exploring further.

# ListItem

## ListItem

`List` 的项模板。它本身不渲染任何结构，只负责把内部根元素重复渲染为每一项。

## 签名

```xml theme={null}
<List Items="{Data.Items}" As="Item">
  <ListItem>
    <Text Value="{Item.Title}" />
  </ListItem>
</List>
```

## 规则

| 规则 | 说明 |
| :- | :- |
| 只能出现在 `List` 内 | 其它位置解析失败 |
| 只能有一个 | `List` 必须且只能包含一个 `ListItem` |
| 只能有一个根元素 | 多个元素请用 `Column`/`Row`/`Container` 包起来 |

## 作用域

`ListItem` 内部：

* `{Item.*}`：当前数组项
* `{Index}`：当前下标，0 起

变量名由父 `List.As` 决定：

```xml theme={null}
<List Items="{Data.Items}" As="News">
  <ListItem>
    <Text Value="{News.Title}" />
  </ListItem>
</List>
```

## 运行时行为

* `List` 按数组长度重复渲染 `ListItem` 的根元素。
* 每个实例有独立的 `Item`/`Index` 作用域。
* 不提供选中态、分隔线或点击事件；需要时在项内放 `Button`/`Link`，或用 `Divider`。
* 项模板中的 `Data` 仍属于组件全局作用域，不是每项独立数据源。

## 示例

```xml theme={null}
<List Items="{Data.Servers}" As="Server" Gap="1">
  <ListItem>
    <Row Justify="Between" Align="Center">
      <Text Value="{Server.Name}" />
      <Text Value="{Server.Players}" Size="Xs" Color="Muted" />
    </Row>
  </ListItem>
</List>
```

## 坑

* `ListItem` 内不能直接写裸文本；用 `Text.Value` / 内容语法 `Text`。
* 项内 `Button` 的 `OnClick` 可以绑定当前项的 `{Item.Url}` 等值。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.