From 1a2d6ada887bc1491d0b90a2249fa27896d2f2ec Mon Sep 17 00:00:00 2001 From: hz4th_coder Date: Tue, 14 Jul 2026 00:16:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=86=85=E5=AE=B9=E5=BA=93?= =?UTF-8?q?=E6=AF=8F=E9=A1=B5=E6=95=B0=E9=87=8F=E9=80=89=E6=8B=A9=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加每页数量选择下拉框(20/50/100/200/500条) - 默认100条,用户可自由选择 --- static/css/library.css | 9 +++++++++ static/js/library.js | 9 ++++++++- templates/library.html | 7 +++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/static/css/library.css b/static/css/library.css index 69160c2..208d7b5 100644 --- a/static/css/library.css +++ b/static/css/library.css @@ -102,6 +102,15 @@ cursor: pointer; } +.page-size-select { + padding: 10px 15px; + border: 1px solid #ddd; + border-radius: 6px; + font-size: 14px; + background: white; + cursor: pointer; +} + .toolbar-right { display: flex; gap: 10px; diff --git a/static/js/library.js b/static/js/library.js index 6b68e0f..bf9cbe4 100644 --- a/static/js/library.js +++ b/static/js/library.js @@ -4,7 +4,7 @@ const API_BASE = ''; // 状态 let articles = []; let currentPage = 1; -let pageSize = 100; // 增加每页数量 +let pageSize = 100; let totalCount = 0; let selectedIds = new Set(); let currentArticleId = null; @@ -31,6 +31,13 @@ document.addEventListener('DOMContentLoaded', () => { }); }); +// 改变每页数量 +function changePageSize() { + pageSize = parseInt(document.getElementById('page-size').value); + currentPage = 1; + loadArticles(); +} + // 加载文章列表 async function loadArticles() { const keyword = document.getElementById('search-input').value.trim(); diff --git a/templates/library.html b/templates/library.html index ca497d1..1840015 100644 --- a/templates/library.html +++ b/templates/library.html @@ -35,6 +35,13 @@ +