修复影像管理翻页不起作用问题

This commit is contained in:
ztx
2025-04-28 23:20:22 +08:00
parent cc80fa9ff2
commit b172e7b271

View File

@@ -109,6 +109,9 @@ function updateImagesPagination(result) {
elements.prevPage.disabled = page <= 1;
elements.nextPage.disabled = page >= totalPages || totalCount === 0;
// 存储总页数到按钮的data属性中
elements.nextPage.setAttribute('data-total-pages', totalPages);
} catch (error) {
handleError(error, '更新分页信息失败');
}
@@ -137,7 +140,7 @@ function bindImagesEvents() {
const newNextBtn = document.getElementById('images-nextPage');
newNextBtn.addEventListener('click', () => {
const totalPages = parseInt(newNextBtn.getAttribute('data-total-pages') || '1');
if (imagesCurrentPage < totalPages) {
if (!newNextBtn.disabled && imagesCurrentPage < totalPages) {
imagesCurrentPage++;
loadImages(imagesCurrentPage);
}