> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# SelectorQuery: selectUniqueID() method

APISummary
通过指定 `uid` 选择节点。通常用于选择事件源的对应节点。

`uid` 是节点的编号。每个节点拥有一个动态分配的独特 `uid`。`uid` 可通过触发的事件获取。

## 语法

```ts
selectUniqueID(uniqueId: string | number): NodesRef;
```

### 参数

#### uniqueId

待选择节点的 `uid`。

### 返回值

代表该查询结果的 `NodesRef` 对象实例。

## 示例

给点击事件的源节点添加背景颜色:

```tsx
const onTap = useCallback((event: ReactLynx.ITouchEvent) => {
  lynx
    .createSelectorQuery()
    .selectUniqueID(event.target.uid)
    .setNativeProps({
      'background-color': 'red',
    })
    .exec();
}, []);
```

## 兼容性

**Compatibility Table**

**Query:** `lynx-api.selector-query.selectUniqueID`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-api/selector-query/selectUniqueID.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| selectUniqueID | Yes (2.3) | Yes (3.4) | Yes (2.3) | Yes (3.7) | Yes (3.7) | Yes |

**`selectUniqueID`**

Select nodes by specifying `uid`.

