更新 attendance.html

master
wangsiyuan 2023-12-25 23:13:51 +08:00
parent 5387b3584b
commit 8edb1cc618
1 changed files with 2 additions and 4 deletions

View File

@ -49,16 +49,14 @@
<script> <script>
// 请求后端获取菜单数据 // 请求后端获取菜单数据
$.get('/api/menu', function (menuItems) { $.get('/api/menu', function (menuItems) {
// 清空原有菜单项
var menuList = $('.layui-nav.layui-nav-tree'); var menuList = $('.layui-nav.layui-nav-tree');
menuList.empty(); menuList.empty();
// 动态添加菜单项
menuItems.forEach(function (item) { menuItems.forEach(function (item) {
menuList.append('<li class="layui-nav-item"><a href="' + item.link + '">' + item.name + '</a></li>'); var href = item.path || 'javascript:void(0);'; // 提供一个默认值
menuList.append('<li class="layui-nav-item"><a href="' + href + '">' + item.name + '</a></li>');
}); });
// 更新菜单布局
layui.element.render('nav', 'test'); layui.element.render('nav', 'test');
}); });