diff --git a/component/pear/module/menu.js b/component/pear/module/menu.js index 33cde7f4a024eb328d44ee98c8a633b33b786b27..a6ceea52ec7699c1eb156bcc4c97b215b3976f04 100644 --- a/component/pear/module/menu.js +++ b/component/pear/module/menu.js @@ -129,6 +129,32 @@ layui.define(['table', 'jquery', 'element'], function (exports) { } clickEvent(dom, data); }) + + $("body").on("click","#" + _this.option.control + " .pear-nav-control [pear-id]", function () { + var dom = $(this); + if ($(this).attr("pear-href") == "javascript:;") { + $("#" + _this.option.elem).find(".pear-nav-tree").css({ + display: 'none' + }); + $("#" + _this.option.elem).find(".pear-nav-tree[pear-id='" + $(this).attr("pear-id") + "']").css({ + display: 'block' + }); + $("#" + _this.option.control).find(".pe-title").html($(this).attr("pear-title")); + $("#" + _this.option.control).find("") + _this.option.change($(this).attr("pear-id"), $(this).attr("pear-title"), $(this).attr("pear-href")) + }else{ + var data = { + menuId: dom.attr("pear-id"), + menuTitle: dom.attr("pear-title"), + menuPath: dom.attr("pear-title"), + menuIcon: dom.attr("pear-icon"), + menuUrl: dom.attr("pear-href"), + openType: dom.attr("pear-type") + }; + clickEvent(dom, data); + + } + }) } function hash(dom) { @@ -330,30 +356,24 @@ layui.define(['table', 'jquery', 'element'], function (exports) { var index = 0; var controlItemPe = '
'; $.each(option.data, function (i, item) { + if(item.children != null && item.children.length > 0){ + item.href = 'javascript:;'; + } var menuItem = ''; var controlItem = ''; - if (i === option.defaultMenu) { - controlItem = '
  • ' + item.title + '
  • '; - menuItem = '