12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 'use strict';
- /**
- *
- *
- * @author Mai
- * @date
- * @version
- */
- (function($){
- $.subMenu = function (setting) {
- const menu = $(setting.menu), miniMenu = $(setting.miniMenu);
- const toMenu = $(setting.toMenu), toMiniMenu = $(setting.toMiniMenu);
- const miniHint = $(setting.miniHint);
- const showMenu = function () {
- menu.show();
- miniMenu.removeClass('d-flex').hide();
- setting.callback({mini: false});
- };
- const showMiniMenu = function () {
- menu.hide();
- miniMenu.addClass('d-flex').show();
- setting.callback({mini: true});
- };
- const menuType = setting.key ? getLocalCache(setting.key) : null;
- if (menuType && menuType === 'miniMenu') {
- showMiniMenu();
- } else {
- showMenu();
- }
- toMenu.click(function () {
- showMenu();
- if (setting.key) {
- setLocalCache(setting.key, 'menu');
- }
- });
- toMiniMenu.click(function () {
- showMiniMenu();
- if (setting.key) {
- setLocalCache(setting.key, 'miniMenu');
- }
- const hint = setting.hintKey ? getLocalCache(setting.hintKey) : '';
- if (hint !== '1') {
- miniHint.popover('show');
- }
- });
- miniMenu.mouseenter(function () {
- $(setting.miniMenuList).show();
- miniHint.popover('hide');
- if (setting.hintKey) {
- setLocalCache(setting.hintKey, '1');
- }
- });
- miniMenu.mouseleave(function () {
- $(setting.miniMenuList).hide();
- });
- }
- })(jQuery);
|