12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- function navBar(data) {
- var ulHtml = '<ul class="layui-nav layui-nav-tree">';
- for (var i = 0; i < data.length; i++) {
- if (data[i].spread) {
- ulHtml += '<li class="layui-nav-item layui-nav-itemed">';
- } else {
- ulHtml += '<li class="layui-nav-item">';
- }
- if (data[i].subMenuList != undefined && data[i].subMenuList.length > 0) {
- ulHtml += '<a href="javascript:;">';
- if (data[i].ico != undefined && data[i].ico != '') {
- if (data[i].ico - 0 == 0) {
- data[i].ico = " ";
- }
- if (data[i].ico.indexOf("icon-") != -1) {
- ulHtml += '<i class="iconfont ' + data[i].ico + '" data-icon="' + data[i].ico + '"></i>';
- } else {
- ulHtml += '<i class="layui-icon" data-icon="' + data[i].ico + '">' + data[i].ico + '</i>';
- }
- }
- ulHtml += '<cite>' + data[i].funName + '</cite>';
- ulHtml += '<span class="layui-nav-more"></span>';
- ulHtml += '</a>'
- ulHtml += '<dl class="layui-nav-child">';
- for (var j = 0; j < data[i].subMenuList.length; j++) {
- ulHtml += '<dd><a href="javascript:;" data-url="' + data[i].subMenuList[j].fileUrl + '?id=' + data[i].subMenuList[j].id + '&ver=' + SYS_VER + '">';
- if (data[i].subMenuList[j].ico != undefined && data[i].subMenuList[j].ico != '') {
- if (data[i].subMenuList[j].ico - 0 == 0) {
- data[i].subMenuList[j].ico = " ";
- }
- if (data[i].subMenuList[j].ico.indexOf("icon-") != -1) {
- ulHtml += '<i class="iconfont ' + data[i].subMenuList[j].ico + '" data-icon="' + data[i].subMenuList[j].ico + '"></i>';
- } else {
- ulHtml += '<i class="layui-icon" data-icon="' + data[i].subMenuList[j].ico + '">' + data[i].subMenuList[j].ico + '</i>';
- }
- }
- ulHtml += '<cite>' + data[i].subMenuList[j].funName + '</cite></a></dd>';
- }
- ulHtml += "</dl>"
- } else {
- ulHtml += '<a href="javascript:;" data-url="' + data[i].fileUrl + '?id=' + data[i].id + '&ver=' + SYS_VER + '">';
- if (data[i].ico != undefined && data[i].ico != '') {
- if (data[i].ico - 0 == 0) {
- data[i].ico = " ";
- }
- if (data[i].ico.indexOf("icon-") != -1) {
- ulHtml += '<i class="iconfont ' + data[i].ico + '" data-icon="' + data[i].ico + '"></i>';
- } else {
- ulHtml += '<i class="layui-icon" data-icon="' + data[i].ico + '">' + data[i].ico + '</i>';
- }
- }
- ulHtml += '<cite>' + data[i].funName + '</cite></a>';
- }
- ulHtml += '</li>'
- }
- ulHtml += '</ul>';
- return ulHtml;
- }
|