从具有不同 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 (将#修改为@)