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 = '';
-
- controlPe += '- ' + item.title + '';
- controlItemPe += '
- ' + item.title + '
';
- } else {
-
- controlItem = ' - ' + item.title + '
';
+ controlItem = '';
- menuItem = '';
- controlItemPe += '- ' + item.title + '
';
-
+ if (i === option.defaultMenu) {
+ controlPe += '- ' + item.title + '';
}
+
+ controlItemPe += '
- ' + item.title + '
';
index++;
$.each(item.children, function (i, note) {
// 创 建 每 一 个 菜 单 项
@@ -391,17 +411,6 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
$("#" + option.control).html(control + "");
$("#" + option.control).append(controlPe);
$("#" + option.elem).html(menu);
- $("#" + option.control + " .pear-nav-control").on("click", "[pear-id]", function () {
- $("#" + option.elem).find(".pear-nav-tree").css({
- display: 'none'
- });
- $("#" + option.elem).find(".pear-nav-tree[pear-id='" + $(this).attr("pear-id") + "']").css({
- display: 'block'
- });
- $("#" + option.control).find(".pe-title").html($(this).attr("pear-title"));
- $("#" + option.control).find("")
- option.change($(this).attr("pear-id"), $(this).attr("pear-title"), $(this).attr("pear-href"))
- })
}
/** 加载子菜单 (递归)*/
@@ -568,4 +577,4 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
}
exports(MOD_NAME, new pearMenu());
-})
+})
\ No newline at end of file