zoukankan      html  css  js  c++  java
  • 五级菜单

    $.each(data,function(i, sm1) {
    console.log(i+"1级:"+sm1.menuid+":"+sm1.menuname);
    var menulist1 = "<ul id='tt1' class='easyui-tree' animate='true' dnd='true'>";
    $.each(sm1.menus, function(i, sm2) {
    console.log(sm2.url);
    console.log(sm2.menus.length);
    console.log(sm2.url!=null && sm2.menus.length==0);
    if(sm2.url!=null && sm2.menus.length==0){
    console.log(sm2.url);
    menulist1 += "<li><a ref='"+sm2.menuid+"' href='#' ref='"+sm2.url+"'> <span class='nav'>"+sm2.menuname+"</span></a>";
    }else{
    menulist1 += "<li> <span class='nav'>"+sm2.menuname+"</span>";
    }

    if(sm2.menus.length>0){
    menulist1 += "<ul>";
    $.each(sm2.menus, function(i, sm3) {
    console.log(sm3.url);
    if(sm3.url!=null && sm3.menus.length==0){
    menulist1 += "<li><a ref='"+sm3.menuid+"' href='#' rel='"+sm3.url+"'> <span class='nav'>"+sm3.menuname+"</span></a>";
    }else{
    menulist1 += "<li> <span class='nav'>"+sm3.menuname+"</span>";
    }

    if(sm3.menus.length>0){
    menulist1 += "<ul>";
    $.each(sm3.menus, function(i, sm4) {
    console.log(i+"-------5级:sm4.menuid="+sm4.menuid+":sm4.menuid="+sm4.menuname);
    if(sm4.url!=null && sm4.menus.length==0){
    menulist1 += "<li><a ref='"+sm4.menuid+"' href='#' rel='"+sm4.url+"'> <span class='nav'>"+sm4.menuname+"</span></a>";
    }else{
    menulist1 += "<li> <span class='nav'>"+sm4.menuname+"</span>";
    }

    if(sm4.menus.length>0){
    menulist1 += "<ul>";
    $.each(sm4.menus, function(i, sm5) {

    if(sm5.url!=null && sm5.menus.length==0){
    menulist1 += "<li><a ref='"+sm5.menuid+"' href='#' rel='"+sm5.url+"'> <span class='nav'>"+sm5.menuname+"</span></a>";
    }else{
    menulist1 += "<li> <span class='nav'>"+sm5.menuname+"</span>";
    }



    menulist1 += "</li>";
    });
    menulist1 += "</ul>";
    }
    menulist1 += "</li>";
    });
    menulist1 += "</ul>";
    //console.log("------------end 4级UL-------------");
    }
    menulist1 += "</li>";
    });
    menulist1 += "</ul>";
    //console.log("------------end 3级UL-------------");
    }

    menulist1 += "</li>";
    });

    //console.log("------------end 2级UL-------------");
    menulist1 += "</ul>";
    //console.log(menulist1);
    $('#wnav').accordion('add', {title : sm1.menuname,content : menulist1,iconCls : 'icon ' + sm1.icon});
    });

  • 相关阅读:
    css word-wrap与word-break区别
    input输入框光标位置问题
    正则表达式(二)- 位置匹配攻略
    正则表达式(一)- 字符匹配攻略
    mac电脑重启nginx报错nginx: [error] invalid PID number "" in "/usr/local/var/run/nginx.pid"
    指定js文件不使用 eslint 语法检查
    管理github/gitlab生成多个ssh key
    前端切图两种方法整理
    梳理:移动端Viewport的知识
    切图 — Photoshop(转载)
  • 原文地址:https://www.cnblogs.com/gzhbk/p/11197595.html
Copyright © 2011-2022 走看看