- 導航菜單默認為垂直模式,通過mode屬性可以使導航菜單變更為水平模式。另外,在菜單中通過submenu組件可以生成二級菜單。Menu 還提供了background-color、text-color和active-text-color,分別用於設置菜單的背景色、菜單的文字顏色和當前激活菜單的文字顏色。
1 <el-menu
2 :default-active="activeIndex"
3 class="el-menu-demo"
4 mode="horizontal" @select="handleSelect"
5 background-color="#545c64"
6 text-color="#fff"
7 active-text-color="red">
8 </el-menu>
.el-menu--horizontal > .el-menu-item {
width: 50%;
border-bottom: none;
height: 1rem;
line-height: 0.5rem;
text-align: center;
}
.el-menu--horizontal > .el-menu-item.is-active {
border-bottom: none;
}