vue-element-admin只有1个二级导航时也要展示
问题: 默认情况下,一级导航下面只有1个二级导航的时候, 一级导航会不做显示, 仅展示二级导航.
需求: 一级导航和二级导航都展示, 如下面右图
仅需要在路由写上这行就行
alwaysShow: true,
// 全部是这样
{
path: "/management",
component: Layout,
redirect: "/management/toPayOrder",
name: "OrderManagement",
alwaysShow: true, // 就是这行显隐起作用的
meta: {
title: "管理",
icon: "el-icon-s-grid"
},
children: [
{
path: "toPayOrder",
name: "ToPayOrder",
component: () => import("@/views/management/toPayOrder"),
meta: {
title: "财务订单",
icon: "el-icon-menu"
},
hidden: false
},
{
path: "toPayOrderDetail",
name: "ToPayOrderDetail",
component: () =>
import("@/views/management/detail/orderDetail"),
meta: {
title: "详情"
},
hidden: true
}
]
},