let form, layer; layui.use(["form", 'layer'], function () { form = layui.form; layer = layui.layer; setMenusData(); if ($('#nav-right ul li').length > 0) { let hrefValue = $('#nav-right ul li').eq(0).attr('hrefValue'); $('#indexIframe').attr('src', hrefValue); } $('#nav-right ul li').on('click', function () { $('#nav-right ul li').each(function (index, item) { if ($(this).hasClass('checked')) { $(this).removeClass('checked').addClass('nocheck'); } }) $(this).removeClass('nocheck').addClass('checked'); const hrefValue = $(this).attr('hrefValue'); $('#indexIframe').attr('src', hrefValue); }) }); /* 初始化菜单 */ function setMenusData(data) { let dataList = [ { menuName: '固定球机', url: 'fiexed_video.html' }, { menuName: '移动球机', url: 'move_video.html' } ]; let html = ''; $.each(dataList, function (index, item) { if (index === 0) { html += '
' + item.menuName + '
' + item.menuName + '