[STYLE] 實作側邊欄啟動時自動捲動至選取項目
1. [STYLE] 在 admin.blade.php 的側邊欄新增 x-init 邏輯。 2. [STYLE] 確保頁面載入時,側邊欄會自動捲動至當前啟動 (active) 的選單項目,優化導航體驗。
This commit is contained in:
parent
4348a88697
commit
5f102fbd7a
@ -254,7 +254,13 @@
|
||||
:class="[
|
||||
sidebarOpen ? 'translate-x-0' : '-translate-x-full lg:translate-x-0',
|
||||
sidebarCollapsed ? 'w-[60px]' : 'w-56'
|
||||
]">
|
||||
]"
|
||||
x-init="$nextTick(() => {
|
||||
const activeItem = $el.querySelector('.active, .bg-slate-100, .dark\\:bg-white\\/5');
|
||||
if (activeItem) {
|
||||
activeItem.scrollIntoView({ block: 'center', behavior: 'instant' });
|
||||
}
|
||||
})">
|
||||
|
||||
<!-- Close Button (Mobile) -->
|
||||
<button type="button" @click="sidebarOpen = false"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user