Browse Source

导航栏over样式调整

zhuth 7 years ago
parent
commit
c38574db1b
1 changed files with 11 additions and 2 deletions
  1. 11 2
      frontend/saas-web/app/view/main/Navigation.js

+ 11 - 2
frontend/saas-web/app/view/main/Navigation.js

@@ -59,11 +59,11 @@ Ext.define('saas.view.main.Navigation', {
         this.showNavMenu(view, record, item, index, e, eOpts);
     },
 
-    showNavMenu: function (view, record, item, index, e, eOpts) {
+    showNavMenu: function (navView, record, navItem, index, e, eOpts) {
         var me = this,
             recData = record.data,
             menuItems = recData.items || [],
-            itemBox = item.getBoundingClientRect(),
+            itemBox = navItem.getBoundingClientRect(),
             pos = [itemBox.left + itemBox.width, itemBox.top],
             id = recData.id,
             menuId = 'navMenu-' + id,
@@ -114,12 +114,17 @@ Ext.define('saas.view.main.Navigation', {
                         menu.setHeight(menuViewHeight);
                         menu.updateLayout();
 
+                        view.el.dom.addEventListener('mouseenter', function (e) {
+                            menu.navItem.classList.add(menu.navView.overItemCls);
+                        });
+
                         view.el.dom.addEventListener('mouseleave', function (e) {
                             var ex = e.clientX,
                                 ey = e.clientY,
                                 box = menuView.getBoundingClientRect();
 
                             if (ey <= box.top || ex >= (box.left + box.width) || ey >= (box.top + box.height) || (ex <= box.left && ey >= (box.top + 64))) {
+                                menu.navItem.classList.remove(menu.navView.overItemCls);
                                 menu.hide();
                             }
                         });
@@ -140,6 +145,7 @@ Ext.define('saas.view.main.Navigation', {
                                     var tabTitle = text + (type == 'form' ? '' : '查询'),
                                         tabId = 'maintab-' + type + '-' + id;
 
+                                    menu.navItem.classList.remove(menu.navView.overItemCls);
                                     openTab(viewType, tabTitle, tabId);
                                     menu.hide();
                                 });
@@ -156,6 +162,7 @@ Ext.define('saas.view.main.Navigation', {
                                     var tabTitle = text + (type == 'form' ? '' : '查询'),
                                         tabId = 'maintab-' + type + '-' + id;
 
+                                    menu.navItem.classList.remove(menu.navView.overItemCls);
                                     openTab(viewType, tabTitle, tabId);
                                     menu.hide();
                                 });
@@ -165,6 +172,8 @@ Ext.define('saas.view.main.Navigation', {
                 }
             });
             var menu = Ext.create('Ext.menu.Menu', {
+                navView: navView,
+                navItem: navItem,
                 id: menuId,
                 width: window.innerWidth,
                 style: {