fix: 支持编辑分类

- 分类项添加编辑按钮
- 悬停时显示编辑按钮
- 点击编辑按钮打开编辑弹窗
This commit is contained in:
小龙
2026-04-06 16:50:50 +00:00
parent 84d9098049
commit e5081fc0d9
2 changed files with 44 additions and 4 deletions
+9 -4
View File
@@ -144,10 +144,15 @@ function App() {
</div>
{categories.map(cat => (
<div key={cat.id} className={`category-item ${selectedCategory === cat.id ? 'active' : ''}`} onClick={() => setSelectedCategory(cat.id)}>
<div className="category-icon"><Icon name={cat.icon || 'folder'} size={14}/></div>
<span className="category-name">{cat.name}</span>
<span className="category-count">{getCategoryCount(cat.id)}</span>
<div key={cat.id} className="category-item-wrapper">
<div className={`category-item ${selectedCategory === cat.id ? 'active' : ''}`} onClick={() => setSelectedCategory(cat.id)}>
<div className="category-icon"><Icon name={cat.icon || 'folder'} size={14}/></div>
<span className="category-name">{cat.name}</span>
<span className="category-count">{getCategoryCount(cat.id)}</span>
</div>
<button className="category-edit-btn" onClick={(e) => { e.stopPropagation(); openModal('category', cat) }} title="编辑">
<Icon name="edit" size={12}/>
</button>
</div>
))}
</div>