From 57e13a496dd393b4761e1e78a767591e472fe74a Mon Sep 17 00:00:00 2001 From: peijunlei Date: Tue, 1 Sep 2026 20:26:56 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=9B=B4=E6=96=B0=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F=E5=92=8C=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=94=AF=E6=8C=81=E5=8F=B6=E5=AD=90=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E7=9A=84=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/themes/dist_static/static/css/category.css | 4 +- public/themes/dist_static/static/js/category.js | 3 +- public/themes/website/1/zh/demo/category.html | 65 ++++++++++++++++++----- 3 files changed, 57 insertions(+), 15 deletions(-) diff --git a/public/themes/dist_static/static/css/category.css b/public/themes/dist_static/static/css/category.css index 89a4663..2708128 100644 --- a/public/themes/dist_static/static/css/category.css +++ b/public/themes/dist_static/static/css/category.css @@ -59,7 +59,6 @@ list-style: none; } .c-sidebar__item.is-active .c-sidebar__trigger { - padding: 2rem 0; color: var(--color-primary); } .c-sidebar__item.is-active .c-sidebar__subs { @@ -118,6 +117,9 @@ transform: rotate(-90deg); color: var(--color-primary); } +.c-sidebar__item.is-leaf .c-sidebar__trigger { + cursor: pointer; +} .c-sidebar__subs { display: none; margin: 0; diff --git a/public/themes/dist_static/static/js/category.js b/public/themes/dist_static/static/js/category.js index 6f4a23d..ce4872c 100644 --- a/public/themes/dist_static/static/js/category.js +++ b/public/themes/dist_static/static/js/category.js @@ -105,7 +105,8 @@ function bindEvents(state) { syncUrl(state); } else { const id = trigger.dataset.categoryId; - if (state.expandedId === id) state.expandedId = ""; + const isLeaf = !!trigger.closest(".c-sidebar__item.is-leaf"); + if (!isLeaf && state.expandedId === id) state.expandedId = ""; else { state.expandedId = id; state.categoryId = id; diff --git a/public/themes/website/1/zh/demo/category.html b/public/themes/website/1/zh/demo/category.html index 92bfffc..f23bf07 100644 --- a/public/themes/website/1/zh/demo/category.html +++ b/public/themes/website/1/zh/demo/category.html @@ -88,30 +88,40 @@ $current_cate_id = $current_cate['id'] ?? '';