1.4.0 • Published 4 years ago

@feizheng/next-tree v1.4.0

Weekly downloads
17
License
MIT
Repository
-
Last release
4 years ago

next-tree

Tree data for next.

version license size download

installation

npm install -S @feizheng/next-tree

apis

apiparamsdescription
childrencallbackFind children only on level
parentcallbackFind parent only one level
descendantscallbackFind descendants recursion
ancestorscallbackFind ancestors recursion
findcallback-
filtercallback-
searchcallback-
tablecallbackCreate table data

usage

import NxTree from '@feizheng/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.

1.4.0

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.7

4 years ago

1.0.5

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago