categories-table.tsx
基本信息
- 类型: React 组件
- 路径:
./src/components/admin/categories-table.tsx
功能描述
管理员分类管理表格组件,支持分类的增删改查操作。提供层级分类展示(父分类和子分类),支持设置分类图标、描述、排序和置顶状态。
导出内容
CategoriesTable- 主组件函数Category- 分类数据类型接口
Props
| 属性 | 类型 | 说明 |
|---|---|---|
| categories | Category[] | 分类数据数组 |
类型定义
interface Category {
id: string;
name: string;
slug: string;
description: string | null;
icon: string | null;
order: number;
pinned: boolean;
parentId: string | null;
parent: { id: string; name: string } | null;
children?: Category[];
_count: {
prompts: number;
children: number;
};
}
依赖
react- useState, useMemonext/navigation- useRouternext-intl- useTranslations@/components/ui/*- Badge, Button, Input, Label, Select, DropdownMenu, Table, Dialog, AlertDialoglucide-react- MoreHorizontal, Plus, Pencil, Trash2, ChevronRight, Pin, PinOffsonner- toast 通知