refactor: update navigation generator

This commit is contained in:
Łukasz Holeczek
2021-08-30 15:02:03 +02:00
parent d37c7f8b02
commit 201c7063c4
2 changed files with 64 additions and 64 deletions
+7 -7
View File
@@ -37,8 +37,8 @@ const AppSidebarNav = defineComponent({
return true
}
if (item.children) {
return item.children.some((child) => isActiveItem(route, child))
if (item.items) {
return item.items.some((child) => isActiveItem(route, child))
}
return false
@@ -47,11 +47,11 @@ const AppSidebarNav = defineComponent({
const renderItem = (item) => {
const route = useRoute()
if (item.children) {
if (item.items) {
return h(
resolveComponent('CNavGroup'),
{
visible: item.children.some((child) => isActiveItem(route, child)),
visible: item.items.some((child) => isActiveItem(route, child)),
},
{
togglerContent: () => [
@@ -61,7 +61,7 @@ const AppSidebarNav = defineComponent({
}),
item.name,
],
default: () => item.children.map((child) => renderItem(child)),
default: () => item.items.map((child) => renderItem(child)),
},
)
}
@@ -76,7 +76,7 @@ const AppSidebarNav = defineComponent({
{
default: (props) =>
h(
resolveComponent(item._name),
resolveComponent(item.component),
{
active: props.isActive,
href: props.href,
@@ -107,7 +107,7 @@ const AppSidebarNav = defineComponent({
},
)
: h(
resolveComponent(item._name),
resolveComponent(item.component),
{},
{
default: () => item.name,