00016-layui 동적 로드 메뉴 laytpl

12205 단어 layui






    
     
    
    
    
    
    






<div lay-templateid="TPL_layout"> <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu"> {{# layui.each(d.data, function(index,item){ }} <li class="layui-nav-item {{ item.spread ? item.children && item.children.length > 0 ? 'layui-nav-itemed' : 'layui-this': '' }}" myDir = "1"> {{# if(item.url){ }} <a lay-href="{{ item.url }}" lay-tips="{{ item.name }}" lay-direction="2"> {{# }else{ }} <a href="javascript:;" lay-tips="{{ item.name }}" lay-direction="2"> {{# } }} {{# if(item.icon){ }} <i class="layui-icon {{ item.icon }}"></i> {{# } }} <cite>{{ item.name }}</cite> </a> {{# var itemListFun = function(children, myDir){ myDir = myDir || 2; if( children && children.length > 0){ }} <dl class="layui-nav-child"> {{# layui.each(children, function(index2, item2){ }} <dd data-name="{{ item2.code || '' }}" class="{{ item2.spread ? (item2.children && item2.children.length > 0 ? 'layui-nav-itemed' : 'layui-this' ) : ''}}" myDir="{{ myDir }}"> {{# if(item2.icon){ }} <i class="layui-icon {{ item.icon }}"></i> {{# } }} {{# if(item2.url){ }} <a lay-href="{{ item2.url }}">{{ item2.name }}</a> {{# }else{ }} <a href="javascript:;">{{ item2.name }}</a> {{# } }} {{# itemListFun(item2.children,myDir+1);}} </dd> {{# }) }} </dl> {{# } }} {{# }; itemListFun(item.children); }} </li> {{# }) }} </ul> </div>

좋은 웹페이지 즐겨찾기