diff --git a/xian_favor/api.py b/xian_favor/api.py index 114ca61..6fe0e15 100644 --- a/xian_favor/api.py +++ b/xian_favor/api.py @@ -1092,8 +1092,6 @@ const API_BASE = '/api'; let currentFilter = { type: '', status: '' }; let currentPage = 1; const pageSize = 20; - -// 工具函数 - 必须先定义 function debounce(fn, delay) { let timer; return function(...args) { @@ -1104,6 +1102,11 @@ function debounce(fn, delay) { // 初始化 document.addEventListener('DOMContentLoaded', async () => { + // 确保初始状态清空 + document.getElementById('searchInput').value = ''; + document.getElementById('typeFilter').value = ''; + currentFilter = { type: '', status: '' }; + await loadStats(); // 先加载统计,确保总数可用 loadItems(); loadTags(); @@ -1154,9 +1157,6 @@ document.addEventListener('DOMContentLoaded', async () => { }); // 加载列表 -let currentPage = 1; -const pageSize = 20; - async function loadItems(page = 1) { currentPage = page; const keyword = document.getElementById('searchInput').value;