From d2f64f98a17a3a728a164cbff696fe02dac5d627 Mon Sep 17 00:00:00 2001 From: hubian <908234780@qq.com> Date: Thu, 16 Apr 2026 13:47:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=B6?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=E6=90=9C=E7=B4=A2=E6=A1=86=E5=92=8C=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 页面加载时强制清空 searchInput - 重置 typeFilter 和 currentFilter - 删除重复的 pageSize 定义 --- xian_favor/api.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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;