控制台应用,yzncms本身基于tp5.1框架,里面的队列用不了,bug,坑
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. layui.define(['table', 'jquery', 'element'], function (exports) {
  2. "use strict";
  3. var MOD_NAME = 'menu',
  4. $ = layui.jquery,
  5. element = layui.element;
  6. var pearMenu = function (opt) {
  7. this.option = opt;
  8. };
  9. pearMenu.prototype.render = function (opt) {
  10. var option = {
  11. elem: opt.elem,
  12. async: opt.async,
  13. parseData: opt.parseData,
  14. url: opt.url,
  15. method: opt.method ? opt.method : "GET",
  16. defaultOpen: opt.defaultOpen,
  17. defaultSelect: opt.defaultSelect,
  18. control: opt.control,
  19. defaultMenu: opt.defaultMenu,
  20. accordion: opt.accordion,
  21. height: opt.height,
  22. theme: opt.theme,
  23. data: opt.data ? opt.data : [],
  24. change: opt.change ? opt.change : function () { },
  25. done: opt.done ? opt.done : function () { }
  26. }
  27. var tempDone = option.done;
  28. option.done = function(){
  29. if (option.control) {
  30. rationalizeHeaderControlWidthAuto(option);
  31. }
  32. tempDone();
  33. }
  34. if (option.async) {
  35. if (option.method === "GET") {
  36. getData(option.url).then(function (data) {
  37. option.data = data;
  38. renderMenu(option);
  39. });
  40. } else {
  41. postData(option.url).then(function (data) {
  42. option.data = data;
  43. renderMenu(option);
  44. });
  45. }
  46. } else {
  47. // 延时返回,和 javascript 执行时序关联
  48. window.setTimeout(function () { renderMenu(option); }, 500);
  49. }
  50. // 处理高度
  51. $("#" + opt.elem).height(option.height)
  52. return new pearMenu(option);
  53. }
  54. pearMenu.prototype.click = function (clickEvent) {
  55. var _this = this;
  56. //左侧子菜单点击
  57. $("body").on("click", "#" + _this.option.elem + " .site-demo-active", function () {
  58. var dom = $(this);
  59. var data = {
  60. menuId: dom.attr("menu-id"),
  61. menuTitle: dom.attr("menu-title"),
  62. menuPath: dom.attr("menu-title"),
  63. menuIcon: dom.attr("menu-icon"),
  64. menuUrl: dom.attr("menu-url"),
  65. openType: dom.attr("open-type")
  66. };
  67. var doms = hash(dom);
  68. if (doms != null) {
  69. if (doms.text() != '') {
  70. data['menuPath'] = doms.find("span").text() + " / " + data['menuPath'];
  71. }
  72. }
  73. if (doms != null) {
  74. var domss = hash(doms);
  75. if (domss != null) {
  76. if (domss.text() != '') {
  77. data['menuPath'] = domss.find("span").text() + " / " + data['menuPath'];
  78. }
  79. }
  80. }
  81. if (domss != null) {
  82. var domsss = hash(domss);
  83. if (domsss != null) {
  84. if (domsss.text() != '') {
  85. data['menuPath'] = domsss.find("span").text() + " / " + data['menuPath'];
  86. }
  87. }
  88. }
  89. if ($("#" + _this.option.elem).is(".pear-nav-mini")) {
  90. if (_this.option.accordion) {
  91. activeMenus = $(this).parent().parent().parent().children("a");
  92. } else {
  93. activeMenus.push($(this).parent().parent().parent().children("a"));
  94. }
  95. }
  96. clickEvent(dom, data);
  97. })
  98. //顶部菜单点击
  99. $("body").on("click","#" + _this.option.control + " .pear-nav-control [pear-id]", function () {
  100. var dom = $(this);
  101. var href = $(this).attr("pear-href");
  102. if (href == "javascript:;") {
  103. $("#" + _this.option.elem).find(".pear-nav-tree").css({
  104. display: 'none'
  105. });
  106. $("#" + _this.option.elem).find(".pear-nav-tree[pear-id='" + $(this).attr("pear-id") + "']").css({
  107. display: 'block'
  108. });
  109. //$("#" + _this.option.control).find(".pe-title").html($(this).attr("pear-title"));
  110. $("#" + _this.option.control).find("")
  111. _this.option.change($(this).attr("pear-id"), $(this).attr("pear-title"), $(this).attr("pear-href"))
  112. }else if(href){
  113. var data = {
  114. menuId: dom.attr("pear-id"),
  115. menuTitle: dom.attr("pear-title"),
  116. menuIcon: dom.attr("pear-icon"),
  117. menuUrl: dom.attr("pear-href"),
  118. openType: dom.attr("pear-type")
  119. };
  120. clickEvent(dom, data, false);
  121. }
  122. })
  123. }
  124. function hash(dom) {
  125. var d = dom.parent().parent().prev();
  126. if (d.prop("tagName") === "UL") {
  127. return null;
  128. }
  129. return d;
  130. }
  131. pearMenu.prototype.skin = function (skin) {
  132. var menu = $(".pear-nav-tree[lay-filter='" + this.option.elem + "']").parent();
  133. menu.removeClass("dark-theme");
  134. menu.removeClass("light-theme");
  135. menu.addClass(skin);
  136. }
  137. pearMenu.prototype.selectItem = function (pearId) {
  138. if (this.option.control != false) {
  139. $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".layui-side-scroll ").find("ul").css({
  140. display: "none"
  141. });
  142. $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".layui-side-scroll ").find(".layui-this").removeClass(
  143. "layui-this");
  144. $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents("ul").css({
  145. display: "block"
  146. });
  147. var controlId = $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents("ul").attr("pear-id");
  148. $("#" + this.option.control).find(".layui-this").removeClass("layui-this");
  149. if (controlId != undefined) {
  150. $("#" + this.option.control).find("[pear-id='" + controlId + "']").addClass("layui-this");
  151. }else{
  152. $("#" + this.option.control).find("[pear-id='" + pearId + "']").addClass("layui-this");
  153. }
  154. }
  155. $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".pear-nav-tree").find(".layui-this").removeClass(
  156. "layui-this");
  157. if (!$("#" + this.option.elem).is(".pear-nav-mini")) {
  158. var openEle = null;
  159. var openEleHeight = 0;
  160. $($("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents('.layui-nav-child').get().reverse()).each(function () {
  161. if (!$(this).parent().is('.layui-nav-itemed')) {
  162. if (openEleHeight == 0) {
  163. openEle = $(this);
  164. } else {
  165. $(this).parent().addClass('layui-nav-itemed');
  166. $(this).css({
  167. height: 'auto',
  168. });
  169. }
  170. openEleHeight += $(this).children("dd").length * 48;
  171. }
  172. });
  173. if (this.option.accordion) {
  174. if (openEleHeight > 0) {
  175. var currentDom = openEle.parent().siblings('.layui-nav-itemed').children(".layui-nav-child");
  176. currentDom.animate({
  177. height: "0px"
  178. }, 240, function () {
  179. currentDom.css({
  180. height: "auto"
  181. });
  182. $(this).parent().removeClass("layui-nav-itemed");
  183. $(this).find('.layui-nav-itemed').removeClass("layui-nav-itemed");
  184. });
  185. }
  186. }
  187. if (openEleHeight > 0) {
  188. openEle.parent().addClass("layui-nav-itemed");
  189. openEle.height(0);
  190. openEle.animate({
  191. height: openEleHeight + "px"
  192. }, 240, function () {
  193. $(this).css({ height: 'auto' });
  194. });
  195. }
  196. }
  197. $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parent().addClass("layui-this");
  198. }
  199. var activeMenus;
  200. pearMenu.prototype.collapse = function (time) {
  201. var elem = this.option.elem;
  202. var config = this.option;
  203. if ($("#" + this.option.elem).is(".pear-nav-mini")) {
  204. $.each(activeMenus, function (i, item) {
  205. $("#" + elem + " a[menu-id='" + $(this).attr("menu-id") + "']").parent().addClass("layui-nav-itemed");
  206. })
  207. $("#" + this.option.elem).removeClass("pear-nav-mini");
  208. $("#" + this.option.elem).animate({
  209. width: "220px"
  210. }, 180);
  211. isHoverMenu(false, config);
  212. var that = this;
  213. $("#" + this.option.elem)
  214. .promise()
  215. .done(function () {
  216. if (that.option.control) {
  217. rationalizeHeaderControlWidth(that.option);
  218. }
  219. })
  220. } else {
  221. activeMenus = $("#" + this.option.elem).find(".layui-nav-itemed>a");
  222. $("#" + this.option.elem).find(".layui-nav-itemed").removeClass("layui-nav-itemed");
  223. $("#" + this.option.elem).addClass("pear-nav-mini");
  224. $("#" + this.option.elem).animate({
  225. width: "60px"
  226. }, 400);
  227. var that = this;
  228. $("#" + this.option.elem)
  229. .promise()
  230. .done(function () {
  231. isHoverMenu(true, config);
  232. if (that.option.control) {
  233. rationalizeHeaderControlWidth(that.option);
  234. }
  235. })
  236. }
  237. }
  238. function getData(url) {
  239. var defer = $.Deferred();
  240. var symbol = url.indexOf('?') !== -1 ? '&' : '?';
  241. $.get(url + symbol + "fresh=" + Math.random(), function (result) {
  242. defer.resolve(result)
  243. });
  244. return defer.promise();
  245. }
  246. function postData(url) {
  247. var defer = $.Deferred();
  248. var symbol = url.indexOf('?') !== -1 ? '&' : '?';
  249. $.post(url + symbol + "fresh=" + Math.random(), function (result) {
  250. defer.resolve(result)
  251. }, "json");
  252. return defer.promise();
  253. }
  254. function renderMenu(option) {
  255. if (option.parseData != false) {
  256. option.parseData(option.data);
  257. }
  258. if (option.data.length > 0) {
  259. if (option.control != false) {
  260. createMenuAndControl(option);
  261. } else {
  262. createMenu(option);
  263. }
  264. }
  265. element.init();
  266. option.done();
  267. }
  268. function createMenu(option) {
  269. var menuHtml = '<div style="height:100%!important;" class="pear-side-scroll layui-side-scroll ' + option.theme + '"><ul lay-filter="' + option.elem +
  270. '" class="layui-nav arrow pear-menu layui-nav-tree pear-nav-tree" '+ (option.accordion ? "lay-accordion" : "") +'>'
  271. $.each(option.data, function (i, item) {
  272. var content = '<li class="layui-nav-item" >';
  273. if (i == option.defaultOpen) {
  274. content = '<li class="layui-nav-item layui-nav-itemed" >';
  275. }
  276. var href = "javascript:;";
  277. var target = "";
  278. var className = "site-demo-active"
  279. item.type = item.childlist != null && item.childlist.length > 0 ? 0 : 1;//此处修改为是否子栏目判断
  280. if (item.openType == "_blank" && item.type == 1) {
  281. href = item.href;
  282. target = "target='_blank'";
  283. className = "";
  284. }
  285. if (item.type == 0) {
  286. // 创 建 目 录 结 构
  287. content += '<a href="javascript:;" menu-type="' + item.type + '" menu-id="' + item.id + '" href="' + href +
  288. '" ' + target + '><i class="' + item.icon + '"></i><span>' + item.title +
  289. '</span></a>';
  290. } else if (item.type == 1) {
  291. content += '<a class="' + className + '" menu-type="' + item.type + '" menu-url="' + item.href + '" menu-id="' +
  292. item.id +
  293. '" menu-title="' + item.title + '" href="' + href + '" ' + target + '><i class="' + item.icon +
  294. '"></i><span>' + item.title + '</span></a>';
  295. }
  296. // 调 用 递 归 方 法 加 载 无 限 层 级 的 子 菜 单
  297. content += loadchild(item);
  298. // 结 束 一 个 根 菜 单 项
  299. content += '</li>';
  300. menuHtml += content;
  301. });
  302. // 结 束 菜 单 结 构 的 初 始 化
  303. menuHtml += "</ul></div>";
  304. // 将 菜 单 拼 接 到 初 始 化 容 器 中
  305. $("#" + option.elem).html(menuHtml);
  306. }
  307. function createMenuAndControl(option) {
  308. var control = '<div class="control"><ul class="layui-nav pear-nav-control pc layui-hide-xs">';
  309. control+= '<li class="layui-nav-item tabdrop layui-hide" style="float:right !important;"><a href="javascript:;"><i class="layui-icon layui-icon-more layui-font-20"></i></a><dl class="layui-nav-child"></dl></li>';
  310. var controlPe = '<ul class="layui-nav pear-nav-control layui-hide-sm">';
  311. // 声 明 头 部
  312. var menu = '<div class="layui-side-scroll ' + option.theme + '">'
  313. // 开 启 同 步 操 作
  314. var index = 0;
  315. var controlItemPe = '<dl class="layui-nav-child">';
  316. $.each(option.data, function (i, item) {
  317. if(item.childlist != null && item.childlist.length > 0){
  318. item.href = 'javascript:;';
  319. }
  320. var menuItem = '';
  321. var controlItem = '';
  322. var target = "";
  323. var href = "javascript:;";
  324. if (item.openType == "_blank" && item.childlist.length == 0) {
  325. href = item.href;
  326. item.href = '';
  327. target = "target='_blank'";
  328. }
  329. if (i === option.defaultMenu) {
  330. controlItem = '<li pear-href="' + item.href + '" pear-title="' + item.title + '" pear-id="' + item.id +
  331. '" class="layui-this layui-nav-item"><a href="'+ href +'" ' + target + '>' + item.title + '</a></li>';
  332. menuItem = '<ul pear-id="' + item.id + '" lay-filter="' + option.elem +
  333. '" class="layui-nav arrow layui-nav-tree pear-nav-tree">';
  334. //controlPe += '<li class="layui-nav-item"><a class="pe-title" href="javascript:;" >' + item.title + '</a>';
  335. controlPe += '<li class="layui-nav-item"><a class="pe-title" href="javascript:;" ><i class="icon iconfont icon-other"></i>&nbsp;选择模块</a>';
  336. controlItemPe += '<dd pear-href="' + item.href + '" pear-title="' + item.title + '" pear-id="' + item.id +
  337. '"><a href="javascript:void(0);">' + item.title + '</a></dd>';
  338. } else {
  339. controlItem = '<li pear-href="' + item.href + '" pear-title="' + item.title + '" pear-id="' + item.id +
  340. '" class="layui-nav-item"><a href="'+ href +'" ' + target + '>' + item.title + '</a></li>';
  341. menuItem = '<ul style="display:none" pear-id="' + item.id + '" lay-filter="' + option.elem +
  342. '" class="layui-nav arrow layui-nav-tree pear-nav-tree">';
  343. controlItemPe += '<dd pear-href="' + item.href + '" pear-title="' + item.title + '" pear-id="' + item.id +
  344. '"><a href="javascript:void(0);">' + item.title + '</a></dd>';
  345. }
  346. index++;
  347. $.each(item.childlist, function (i, note) {
  348. // 创 建 每 一 个 菜 单 项
  349. var content = '<li class="layui-nav-item" >';
  350. var href = "javascript:;";
  351. var target = "";
  352. var className = "site-demo-active";
  353. note.type = note.childlist != null && note.childlist.length > 0 ? 0 : 1;//此处修改为是否子栏目判断
  354. if (note.openType == "_blank" && note.type == 1) {
  355. href = note.href;
  356. target = "target='_blank'";
  357. className = "";
  358. }
  359. // 判 断 菜 单 类 型 0 是 不可跳转的目录 1 是 可 点 击 跳 转 的 菜 单
  360. if (note.type == 0) {
  361. // 创 建 目 录 结 构
  362. content += '<a href="' + href + '" ' + target + ' menu-type="' + note.type + '" menu-id="' + note.id +
  363. '" ><i class="' + note.icon + '"></i><span>' + note.title +
  364. '</span></a>';
  365. } else if (note.type == 1) {
  366. // 创 建 菜 单 结 构
  367. content += '<a ' + target + ' class="' + className + '" menu-type="' + note.type + '" menu-url="' + note.href +
  368. '" menu-id="' + note.id +
  369. '" menu-title="' + note.title + '" href="' + href + '"><i class="' + note.icon +
  370. '"></i><span>' + note.title + '</span></a>';
  371. }
  372. content += loadchild(note);
  373. content += '</li>';
  374. menuItem += content;
  375. })
  376. menu += menuItem + '</ul>';
  377. control += controlItem;
  378. })
  379. controlItemPe += "</li></dl></ul>"
  380. controlPe += controlItemPe;
  381. $("#" + option.control).html(control + "</div>");
  382. $("#" + option.control).append(controlPe);
  383. $("#" + option.elem).html(menu);
  384. }
  385. /** 加载子菜单 (递归)*/
  386. function loadchild(obj) {
  387. // 判 单 是 否 是 菜 单, 如 果 是 菜 单 直 接 返 回
  388. obj.type = obj.childlist != null && obj.childlist.length > 0 ? 0 : 1;//此处修改为是否子栏目判断
  389. if (obj.type == 1) {
  390. return "";
  391. }
  392. // 创 建 子 菜 单 结 构
  393. var content = '<dl class="layui-nav-child">';
  394. // 如 果 嵌 套 不 等 于 空
  395. if (obj.childlist != null && obj.childlist.length > 0) {
  396. // 遍 历 子 项 目
  397. $.each(obj.childlist, function (i, note) {
  398. // 创 建 子 项 结 构
  399. content += '<dd>';
  400. var href = "javascript:;";
  401. var target = "";
  402. var className = "site-demo-active";
  403. if (note.openType == "_blank" && note.type == 1) {
  404. href = note.href;
  405. target = "target='_blank'";
  406. className = "";
  407. }
  408. note.type = note.childlist != null && note.childlist.length > 0 ? 0 : 1;//此处修改为是否子栏目判断
  409. // 判 断 子 项 类 型
  410. if (note.type == 0) {
  411. // 创 建 目 录 结 构
  412. content += '<a ' + target + ' href="' + href + '" menu-type="' + note.type + '" menu-id="' + note.id +
  413. '"><i class="' + note.icon + '"></i><span>' + note.title + '</span></a>';
  414. } else if (note.type == 1) {
  415. // 创 建 菜 单 结 构
  416. content += '<a ' + target + ' class="' + className + '" menu-type="' + note.type + '" menu-url="' + note.href +
  417. '" menu-id="' + note.id + '" menu-title="' + note.title + '" menu-icon="' + note.icon + '" href="' + href +
  418. '" ><i class="' + note.icon + '"></i><span>' + note.title + '</span></a>';
  419. }
  420. // 加 载 子 项 目 录
  421. content += loadchild(note);
  422. // 结 束 当 前 子 菜 单
  423. content += '</dd>';
  424. });
  425. // 封 装
  426. } else {
  427. content += '<dd style="background-color: transparent!important;"><a style="background-color: transparent!important;margin-left: 26px">目录为空</a></dd>';
  428. }
  429. content += '</dl>';
  430. return content;
  431. }
  432. /** 二 级 悬 浮 菜 单*/
  433. function isHoverMenu(b, option) {
  434. if (b) {
  435. var navItem = "#" + option.elem + ".pear-nav-mini .layui-nav-item";
  436. var navChildDl = navItem + " .layui-nav-child>dl";
  437. var navChildDd = navItem + " .layui-nav-child>dd";
  438. $(navItem + "," + navChildDd).mouseenter(function () {
  439. var _this = $(this);
  440. _this.siblings().find(".layui-nav-child")
  441. .removeClass("layui-nav-hover").css({
  442. left: 0,
  443. top: 0
  444. });
  445. _this.children(".layui-nav-child").addClass("layui-nav-hover");
  446. var height = $(window).height();
  447. var topLength = _this.offset().top;
  448. var thisHeight = _this.children(".layui-nav-child").height();
  449. if ((thisHeight + topLength) > height) {
  450. topLength = height - thisHeight - 10;
  451. }
  452. var left = _this.offset().left + 60;
  453. if (!_this.hasClass("layui-nav-item")) {
  454. left = _this.offset().left + _this.width();
  455. }
  456. _this.children(".layui-nav-child").offset({
  457. top: topLength,
  458. left: left
  459. });
  460. });
  461. $(navItem + "," + navChildDl).mouseleave(function () {
  462. var _this = $(this);
  463. _this.closest('.layui-nav-item')
  464. .find(".layui-nav-child")
  465. .removeClass("layui-nav-hover")
  466. .css({
  467. left: 0,
  468. top: 0
  469. });
  470. });
  471. } else {
  472. $("#" + option.elem + " .layui-nav-item").off('mouseenter').unbind('mouseleave');
  473. $("#" + option.elem + " dd").off('mouseenter').unbind('mouseleave');
  474. }
  475. }
  476. function rationalizeHeaderControlWidth(option) {
  477. var $headerControl = $("#" + option.control);
  478. var $nextEl = $headerControl.next();
  479. var rationalizeWidth;
  480. if ($nextEl.length) {
  481. rationalizeWidth = $nextEl.position().left - $headerControl.position().left;
  482. } else {
  483. rationalizeWidth = $headerControl.parent().innerWidth() - $headerControl.position().left;
  484. }
  485. $("#" + option.control + " .control").css({"width": rationalizeWidth});
  486. var navobj = $("#" + option.control+' ul.pear-nav-control.pc');
  487. var dropdown = $(".tabdrop", navobj);
  488. var collection = 0;
  489. var maxwidth = rationalizeWidth - 60;
  490. var liwidth = 0;
  491. //检查超过一行的标签页
  492. $('.tabdrop').find('dd').each(function(){
  493. var newLI = $('<li></li>').html($(this).html());
  494. newLI.addClass('layui-nav-item');
  495. newLI.attr('pear-href', $(this).attr('pear-href'));
  496. newLI.attr('pear-title', $(this).attr('pear-title'));
  497. newLI.attr('pear-id', $(this).attr('pear-id'));
  498. navobj.append(newLI);
  499. $(this).remove();
  500. })
  501. //var litabs = navobj.append(dropdown.find('dd')).find('>li').not('.tabdrop');
  502. var litabs = navobj.find('>li').not('.tabdrop');
  503. var totalwidth = 0;
  504. litabs.each(function () {
  505. totalwidth += $(this).outerWidth(true);
  506. });
  507. if (rationalizeWidth < totalwidth) {
  508. litabs.each(function () {
  509. liwidth += $(this).outerWidth(true);
  510. if (liwidth > maxwidth) {
  511. var newDD = $('<dd></dd>').html($(this).html());
  512. newDD.attr('pear-href', $(this).attr('pear-href'));
  513. newDD.attr('pear-title', $(this).attr('pear-title'));
  514. newDD.attr('pear-id', $(this).attr('pear-id'));
  515. dropdown.find('dl').append(newDD);
  516. collection++;
  517. $(this).remove();
  518. }
  519. });
  520. if (collection > 0) {
  521. dropdown.removeClass('layui-hide');
  522. if (dropdown.find('.active').length === 1) {
  523. dropdown.addClass('active');
  524. } else {
  525. dropdown.removeClass('active');
  526. }
  527. }
  528. }else {
  529. dropdown.addClass('layui-hide');
  530. }
  531. }
  532. function rationalizeHeaderControlWidthAuto(option){
  533. $(window).on('resize', function () {
  534. rationalizeHeaderControlWidth(option);
  535. })
  536. $(document).ready(function () {
  537. rationalizeHeaderControlWidth(option);
  538. });
  539. }
  540. exports(MOD_NAME, new pearMenu());
  541. })