This commit is contained in:
root 2025-07-13 00:20:34 +08:00
parent 4b876f3c0d
commit cb494dd28e
1 changed files with 6 additions and 5 deletions

View File

@ -13,17 +13,18 @@ import {
const ResourceCategoryPageV2: React.FC = () => {
// 使用 Zustand store 管理分类数据
const { categories, loading, error } = useCategoriesData()
const { categories, loading } = useCategoriesData()
const {
loadCategories,
refreshCategories,
addCategory,
updateCategory,
removeCategory,
clearError,
searchCategories
removeCategory
} = useCategoryActions()
// 从 store 获取搜索功能
const { searchCategories } = useCategoryStore()
// 本地 UI 状态
const [searchTerm, setSearchTerm] = useState('')
const [editingCategory, setEditingCategory] = useState<ResourceCategoryV2 | null>(null)
@ -292,7 +293,7 @@ const ResourceCategoryPageV2: React.FC = () => {
placeholder="搜索分类..."
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
onKeyPress={(e) => e.key === 'Enter' && handleSearch()}
onKeyDown={(e) => e.key === 'Enter' && handleSearch()}
className="pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent w-full"
/>
</div>