layui is not defined
<div class="layui-body"> | |
<!-- 内容主体区域 --> | |
<div class="layui-tab" lay-filter="menu" lay-allowClose="true"> | |
<ul class="layui-tab-title"> | |
<li class="layui-this">欢迎页</li> | |
</ul> | |
<div class="layui-tab-content"> | |
<div class="layui-tab-item layui-show">欢迎使用本系统</div> | |
</div> | |
</div> | |
</div> | |
<div class="layui-footer"> | |
<!-- 底部固定区域 --> | |
© laoyuan - 底部固定区域 | |
</div> | |
</div> | |
<script src="/webjars/layui/layui.all.js"></script> | |
<script src="/webjars/jquery/3.6.0/jquery.js"></script> | |
<script src="/js/login/main.js"></script> |
-----------------------------
function showTab(url,name,id) { let length = $("li[lay-id="+id+"]").length; let element = layui.element; if (length == 0 ) { let fullUrl = "/" + url; let height = $(window).height() - 185; let content = '<iframe style ="width:100%;height: '+height+'px" src = "'+fullUrl+'" frameborder="0" scrolling="no">'; element.tabAdd('menu', { title : name, content : content, id : id } ); } element.tabChange('menu',id); }
自己解决了,layui版本太高,layui.all.js改为layui.js解决。