精简代码以及优化菜单
This commit is contained in:
parent
0d38a27fd2
commit
cdfadad2c6
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<nav class="navbar navbar-expand-lg bd-navbar sticky-top bg-body">
|
<nav class="navbar navbar-expand-lg bd-navbar sticky-top bg-body" id="nav">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a class="navbar-brand" href="{{ route('admin.index') }}">
|
<a class="navbar-brand" href="{{ route('admin.index') }}">
|
||||||
管理员
|
管理员
|
||||||
|
@ -160,24 +160,11 @@ class="d-none">
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const nav = document.getElementById('nav');
|
|
||||||
|
|
||||||
@if (session('auth.password_confirmed_at'))
|
@if (session('auth.password_confirmed_at'))
|
||||||
nav.style.backgroundColor = 'rgb(234 234 234 / 9%)';
|
const nav = document.getElementById('nav');
|
||||||
|
nav.style.backgroundColor = 'rgb(234 234 234 / 9%)';
|
||||||
nav.classList.remove('bg-body');
|
nav.classList.remove('bg-body');
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
// 根据 URL 自动激活导航栏
|
|
||||||
const navLinks = document.querySelectorAll('#nav .nav-link, #nav .dropdown-item');
|
|
||||||
const currentUrl = window.location.href;
|
|
||||||
|
|
||||||
for (let i = 0; i < navLinks.length; i++) {
|
|
||||||
const navLink = navLinks[i];
|
|
||||||
if (currentUrl === navLink.href) {
|
|
||||||
navLink.classList.add('active');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user