Nasal Pathway Melodrama

    @jswork/next-tree

    1.0.1 • Public • Published

    next-tree

    Tree data for next.

    version license size download

    installation

    npm install -S @jswork/next-tree

    apis

    api params description
    children callback Find children only on level
    parent callback Find parent only one level
    descendants callback Find descendants recursion
    ancestors callback Find ancestors recursion
    find callback -
    filter callback -
    search callback -
    table callback Create table data

    usage

    import NxTree from '@jswork/next-tree';
    
    const treeData = {
      label: '空间',
      value: '/admin/space',
      children: [
        {
          label: '空间-子级1',
          value: '/admin/space/:id',
          children: [
            {
              label: '空间导出',
              value: '/admin/space/:id/export'
            }
          ]
        },
        {
          label: '空间-子级2',
          value: '/admin/space2/:id',
          children: [
            {
              label: '空间导出222',
              value: '/admin/space/:id/expor2222t'
            }
          ]
        }
      ]
    };
    
    const item = NxTree.create(treeData).find((_, item) => item.label === '空间导出222');
    const data = NxTree.serialize(item);
    
    // results:
    {
      label: '空间导出222',
      value: '/admin/space/:id/expor2222t',
      depth: 2,
      independent: true
    }

    license

    Code released under the MIT license.

    Install

    npm i @jswork/next-tree

    DownloadsWeekly Downloads

    4

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    10.6 kB

    Total Files

    5

    Last publish

    Collaborators

    • afeiship