fix: 修复回收站点击事件被侧边栏通用处理器捕获的问题

- 只为有 data-filter 属性的链接添加过滤事件处理器
- 回收站链接使用 onclick 内联事件,不会被通用处理器干扰
- 从回收站返回时正确重置 trashView 状态
This commit is contained in:
2026-04-19 17:07:48 +08:00
parent 79e4eb4de0
commit 51cecf1f4e

View File

@@ -1362,9 +1362,15 @@ document.addEventListener('DOMContentLoaded', async () => {
});
// 侧边栏过滤
document.querySelectorAll('.sidebar a').forEach(a => {
document.querySelectorAll('.sidebar a[data-filter]').forEach(a => {
a.addEventListener('click', (e) => {
e.preventDefault();
// 如果在回收站视图,先退出
if (trashView) {
trashView = false;
}
document.querySelectorAll('.sidebar a').forEach(x => x.classList.remove('active'));
a.classList.add('active');