Bootstrap

elementui二级菜单

<el-menu router :default-active="activeIndex" mode="horizontal"  @select="handleSelectMenu">

              <!-- <el-menu-item  style="border:none" v-for="(item,index) in menuData"  :index="index+''" :key="index"  :route="{name:item.routername}">{{item.name}}</el-menu-item> -->

                <template v-for="(item,index) in menuData" >

                  <el-submenu   :index="index+''" :key="index" v-if="item.children.length>0">

                    <template slot="title">{{item.name}}</template>

                    <el-menu-item v-for="(i,index1) in item.children" :key="index1" :index="i.routername" >{{i.name}}</el-menu-item>

                  </el-submenu>

                  <el-menu-item v-else  style="border:none"   :index="item.routername" :key="index"  :route="{name:item.routername}">{{item.name}}</el-menu-item>

                </template>

                

            </el-menu>

 

 

数据

 menuData:[

        {

          name:'首页',

          routername:'index',

          children:[]

        },{

          name:'交易大厅',

          routername:'trade',

          children:[]

        },{

          name:'智慧服务',

          routername:'',

          children:[

            {

              name:'场景式服务',

              routername:'serviceIntelligent/sence'

            },{

              name:'AI客服',

              routername:''

            },{

              name:'智库服务',

              routername:''

            }

          ]

        },{

          name:'公示公告',

          routername:'notice',

          children:[]

        },{

          name:'政策法规',

          routername:'laws',

          children:[]

        },{

          name:'操作指南',

          routername:'guide',

          children:[]

        },{

          name:'个人中心',

          routername:'',

          children:[]

        }

      ],

;