Element: [Bug Report] Hide submenu panel when cascader element has no children

Created on 6 Mar 2018  ·  3Comments  ·  Source: ElemeFE/element

Element UI version

2.2.1

OS/Browsers version

Chrome Version 63.0.3239.108 (Official Build) (64-bit)

Vue version

2.5.13

Reproduction Link

https://jsfiddle.net/Alexee/jym5u08f/1/

Steps to reproduce

Data: delete children property or make it an empty array
Interaction:
1.hover on normal menu item,
2.showing submenu panel

  1. then hover on the menu item which has no children or children length equals 0
  2. submenu panel still exist

What is Expected?

when hover on the menu item which has no children, hide submenu panel

What is actually happening?

showing empty panel

Most helpful comment

Perhaps we could add a attribute called 'hide-empty-children' that would not result in significant changes. Convenient for developers without manually removing empty child nodes.

All 3 comments

Currently the dynamic loading functionality replies on the item to be loaded having a children length of 0. So we may have to keep it as is for now. You can take care of those empty children list on your end, e.g. removing the children prop from the item. Items having no children actually works fine: https://jsfiddle.net/jym5u08f/2/.

To fully resolve this, we may introduce another prop indicating if the item is a leaf node. This will require the users to add such prop to the items if they're using dynamic loading, making it a breaking change. So we'll not do it before a major version.

When hover on normal menu item, submenu panel shows, after that, when hover on empty menu, I expect the submenu panel to hide. @Leopoldthecoder
Just personal opinion, I am not sure how other people feel.

Perhaps we could add a attribute called 'hide-empty-children' that would not result in significant changes. Convenient for developers without manually removing empty child nodes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

no5no6 picture no5no6  ·  3Comments

yubo111 picture yubo111  ·  3Comments

yuchonghua picture yuchonghua  ·  3Comments

gengxuelei picture gengxuelei  ·  3Comments

EdenSpark picture EdenSpark  ·  3Comments