vue element menu侧边导航栏
<template>
<!--el-menu里的颜色是通过element定义的属性来设置的,css样式中没有相关样式-->
<!--unique-opened 只摊开一个el-submenu,默认是弹开所有.这个属性依赖于submenu的index值,如果index值相同的会同时展开-->
<!--router用来开启el-menu-item的路由模型,默认连接是index的值-->
<el-menu background-color="#333744" text-color="#fff" active-text-color="#ffd04b" unique-opened router>
<el-submenu index="1"> <!--index属性用于区别不同的submenu-->
<template slot="title"><!--slot属性表明该template是submenu的标题-->
<i class="el-icon-location"></i> <!--添加左侧的小图标-->
<span>导航一</span><!--添加标题名称-->
</template>
<el-menu-item index="1-1">选项1</el-menu-item><!--添加二级选项-->
<el-menu-item index="1-2">选项2</el-menu-item><!--添加二级选项-->
</el-submenu>
<el-submenu index="2">
<template slot="title"><!--slot属性表明该template是submenu的标题-->
<i class="el-icon-location"></i> <!--添加左侧的小图标-->
<span>导航一</span><!--添加标题名称-->
</template>
<el-menu-item index="2-1">选项1</el-menu-item><!--添加二级选项-->
<el-menu-item index="2-2">选项2</el-menu-item><!--添加二级选项-->
</el-submenu>
</el-menu>
</template>
<script>
export default {
name: 'Home'
}
</script>
<style scoped>
</style>
参考:
https://element.eleme.io/\#/zh-CN/component/menu\#ce-lan
还没有评论,来说两句吧...