fix: 搜索功能修复 - debounce函数定义顺序
- debounce函数在使用前必须先定义 - 之前定义在代码末尾,导致搜索事件绑定失败 - 现移到代码开头,确保正确执行
This commit is contained in:
@@ -1090,6 +1090,17 @@ INDEX_TEMPLATE = '''
|
|||||||
<script>
|
<script>
|
||||||
const API_BASE = '/api';
|
const API_BASE = '/api';
|
||||||
let currentFilter = { type: '', status: '' };
|
let currentFilter = { type: '', status: '' };
|
||||||
|
let currentPage = 1;
|
||||||
|
const pageSize = 20;
|
||||||
|
|
||||||
|
// 工具函数 - 必须先定义
|
||||||
|
function debounce(fn, delay) {
|
||||||
|
let timer;
|
||||||
|
return function(...args) {
|
||||||
|
clearTimeout(timer);
|
||||||
|
timer = setTimeout(() => fn.apply(this, args), delay);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
@@ -2196,14 +2207,6 @@ async function sendItemEmail() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function debounce(fn, delay) {
|
|
||||||
let timer;
|
|
||||||
return function(...args) {
|
|
||||||
clearTimeout(timer);
|
|
||||||
timer = setTimeout(() => fn.apply(this, args), delay);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============ 提醒功能 ============
|
// ============ 提醒功能 ============
|
||||||
|
|
||||||
let reminderData = null;
|
let reminderData = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user