如何解决从具有不同 slug 的数组构建对象
我必须将来自 [[...slug.tsx]] 的不同 slug 数组转换为捕获对象中的所有路由。 数组:
['security','security/company','security/people','security/people/overview','security/company/about','security/product','security/people/overview/steps','security/product/getting-started']
我的想法是拥有一个对象数组,如下所示:
const securitySections = [
{
title: "Company",href: '/security/company',links: [
{
title: "Overview",href: "/security/company/about",links: [],},],{
title: "People",href: '/security/people',href: "/security/people/overview",links: [
{
title: "Steps",href: "/security/people/overview/steps",{
title: "Product",href: '/security/product',links: [
{
title: "Getting Started",href: "/security/product/getting-started",}
],];
知道我该怎么做吗?谢谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。