Skip to content

Commit 711678e

Browse files
committed
修复精选数量不对问题
1 parent 1fd585e commit 711678e

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/main.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ async function updateCategoryCounts() {
179179
allNavItem.textContent = currentPrompts.length.toString();
180180
}
181181

182+
// 更新"精选"分类的计数(置顶的提示词)
183+
const featuredCount = currentPrompts.filter(prompt => prompt.pinned).length;
184+
const featuredNavItem = document.querySelector('[data-category="featured"] .count');
185+
if (featuredNavItem) {
186+
featuredNavItem.textContent = featuredCount.toString();
187+
}
188+
182189
// 更新现有分类的计数
183190
const allNavItems = document.querySelectorAll('.nav-item[data-category]');
184191
allNavItems.forEach(item => {
@@ -202,6 +209,13 @@ async function updateCategoryCounts() {
202209
if (allNavItem) {
203210
allNavItem.textContent = currentPrompts.length.toString();
204211
}
212+
213+
// 同时更新"精选"分类
214+
const featuredCount = currentPrompts.filter(prompt => prompt.pinned).length;
215+
const featuredNavItem = document.querySelector('[data-category="featured"] .count');
216+
if (featuredNavItem) {
217+
featuredNavItem.textContent = featuredCount.toString();
218+
}
205219
}
206220
}
207221

0 commit comments

Comments
 (0)