Element UI menu bar click twice to highlight the bug

Time:2022-2-7
Element UI menu bar click twice to highlight the bug

image.png

Element UI menu bar click twice to highlight the bug

image.png

The menu bar cannot be highlighted. Default active = “is added$

Element UI menu bar click twice to highlight the bug

image.png

route. Double click the menu bar after push (‘/ xxx’) to highlight it. Baidu knows that it is the problem caused by the inconsistency between default active and index attributes.
Therefore, based on the experience of a blogger, change the default active = “$route. Path” to a calculation attribute “activemenu” to control

Element UI menu bar click twice to highlight the bug

image.png

Element UI menu bar click twice to highlight the bug

image.png

The problem that needs to be highlighted by double clicking can be solved, but there is still a legacy bug through this$ route. After pushing (” / xxx ”), the menu bar is not highlighted by default for the first time. Finally, the method of a blogger is used for reference
https://www.cnblogs.com/liuqin-always/p/11603708.html
Using the route attribute, and in order to ensure the consistency between the index attribute and the default active attribute, set the name attribute of the route to index and default active, which can completely solve this problem and keep the current menu bar highlighted after refreshing

Element UI menu bar click twice to highlight the bug

image.png

Element UI menu bar click twice to highlight the bug

image.png