> For AI agents: the complete documentation index is available at https://docs.halo.run/llms.txt, the full documentation bundle is available at https://docs.halo.run/llms-full.txt.

# 回复数据列表操作菜单

此扩展点用于扩展回复数据列表的操作菜单项。

![回复数据列表操作菜单](/img/developer-guide/plugin/extension-points/ui/reply-list-item-operation-create.png)

## 定义方式

```ts
export default definePlugin({
  extensionPoints: {
    "reply:list-item:operation:create": (
      reply: Ref<ListedReply>,
    ): OperationItem<ListedReply>[] => {
      return [
        {
          priority: 10,
          component: markRaw(VDropdownItem),
          props: {},
          action: (item?: ListedReply) => {
            // do something
          },
          label: "foo",
          hidden: false,
          permissions: [],
          children: [],
        },
      ];
    },
  },
});
```

`OperationItem<T>` 由 `@halo-dev/ui-shared` 提供，请直接使用当前依赖中的类型。`priority` 和使用 `markRaw` 包装的 `component` 为必需字段；`props`、`action`、`label`、`hidden`、`permissions` 和递归的 `children` 为可选字段。

`priority` 越小，操作项的显示位置越靠前（内置操作项通常以 0、10、20… 依次排列，如需插入到内置项之间，可选择中间值）。

## 示例

此示例将实现一个操作菜单项。

```ts
import type { ListedReply } from "@halo-dev/api-client";
import { VDropdownItem } from "@halo-dev/components";
import { definePlugin } from "@halo-dev/ui-shared";
import { markRaw } from "vue";

export default definePlugin({
  extensionPoints: {
    "reply:list-item:operation:create": () => {
      return [
        {
          priority: 21,
          component: markRaw(VDropdownItem),
          label: "测试回复菜单",
          permissions: [],
          action: async (reply: ListedReply) => {
            console.log(reply);
          },
        },
      ];
    },
  },
});
```

## 类型定义

### ListedReply

`ListedReply` 由 `@halo-dev/api-client` 提供，请直接使用当前依赖中的生成类型。它包含：

- `reply`：回复资源。
- `owner`：解析后的回复者信息。
- `stats`：回复的统计数据。
