ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.12k stars 14.64k forks source link

[Feature Request] supports the state of binding NavMenu and shows which navigation should be opened. #11455

Closed axetroy closed 6 years ago

axetroy commented 6 years ago

Existing Component

Component Name

menu

Description

有一些页面需要跳转路由. 在Javascript代码里面运行的.

这就导致了路由跳转了,导航栏还是原来的那个状态,对应的导航没有被打开.

能否通过一个绑定属性,来显示的指定哪个导航是被打开的?

default-activedefault-openeds都只是绑定了初始化的状态.

可以另起一个属性绑定,来显示的指定哪个导航应该是打开状态吗?

element-bot commented 6 years ago

Translation of this issue:

Existing Component yes

Component Name Menu

Description There are pages that need to be routed and run in Javascript code.

This leads to routing jumps, and the navigation bar is still in the original state, and the corresponding route has not been opened. Can you specify which navigation is opened through a binding property?

default-active and default-openeds only bind the initialized state. Another attribute binding can be displayed to show which navigation should be open.

jikkai commented 6 years ago

可以尝试下

<el-menu :default-active="$route.path"></el-menu>