Element: NavMenu: passing named route instead of path - is it possible?

Created on 10 Jan 2017  ·  2Comments  ·  Source: ElemeFE/element

ElementUI version

1.0.3

Vue version

latest 2.x

Is it possible to pass a 'named route' (of the vue-router) to the NavMenu? I can pass a simple path and it works. I tried passing an object such as {'name':'myNamedRoute'} but with no success. Thanks.

Most helpful comment

I'm sorry, i missed that "index" is still required and used "route" instead of ":route", here it works:

        <el-menu class="el-menu-vertical-demo" theme="dark" :router="true">
          <el-menu-item index="1" :route="{name:'dashboard'}">Dashboard</el-menu-item>
          <el-menu-item index="2" :route="{name:'streams'}">Streams</el-menu-item>
        </el-menu>        

All 2 comments

I'm sorry, i missed that "index" is still required and used "route" instead of ":route", here it works:

        <el-menu class="el-menu-vertical-demo" theme="dark" :router="true">
          <el-menu-item index="1" :route="{name:'dashboard'}">Dashboard</el-menu-item>
          <el-menu-item index="2" :route="{name:'streams'}">Streams</el-menu-item>
        </el-menu>        

@pipejesus Thank you so much for this solution

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kingwl picture Kingwl  ·  3Comments

gengxuelei picture gengxuelei  ·  3Comments

yuchonghua picture yuchonghua  ·  3Comments

dbskccc picture dbskccc  ·  3Comments

Zhao-github picture Zhao-github  ·  3Comments