mirror of
https://github.com/KingHWJ/WeReadBoard.git
synced 2026-11-03 18:24:58 +08:00
fix: close thoughts page and modal when switching nav tabs
switchTab() now checks if the thoughts detail page or book detail modal is open and closes them before switching to the target tab. Previously, when on the thoughts page, clicking any nav tab (charts, ranking, etc.) would silently fail because mainView was still hidden.
This commit is contained in:
1 parent
90b9614b5e
commit
ec88707e6b
1 file changed
+11
@@ -112,6 +112,17 @@ function showDBAlert(message) {
|
||||
// ===== 标签页切换 =====
|
||||
|
||||
function switchTab(tabName) {
|
||||
// 如果想法详情页正在显示,先关闭它回到主视图
|
||||
const thoughtsPage = document.getElementById("thoughtsPage");
|
||||
if (thoughtsPage && thoughtsPage.style.display !== "none") {
|
||||
thoughtsPage.style.display = "none";
|
||||
document.getElementById("mainView").style.display = "";
|
||||
currentThoughtsData = null;
|
||||
}
|
||||
|
||||
// 关闭可能打开的弹窗
|
||||
closeModal("bookDetailModal");
|
||||
|
||||
document.querySelectorAll(".tab-panel").forEach((panel) => {
|
||||
panel.classList.remove("active");
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user