bootstrap-treeview展示树形用户数据

导入相关JS和CSS





引用树形数据

var defaultData = [
          {
            text: 'Parent 1',
            href: '#parent1',
            tags: ['4'],
            nodes: [
              {
                text: 'Child 1',
                href: '#child1',
                tags: ['2'],
                nodes: [
                  {
                    text: 'Grandchild 1',
                    href: '#grandchild1',
                    tags: ['0']
                  },
                  {
                    text: 'Grandchild 2',
                    href: '#grandchild2',
                    tags: ['0']
                  }
                ]
              },
              {
                text: 'Child 2',
                href: '#child2',
                tags: ['0']
              }
            ]
          },
          {
            text: 'Parent 2',
            href: '#parent2',
            tags: ['0']
          },
          {
            text: 'Parent 3',
            href: '#parent3',
             tags: ['0']
          },
          {
            text: 'Parent 4',
            href: '#parent4',
            tags: ['0']
          },
          {
            text: 'Parent 5',
            href: '#parent5'  ,
            tags: ['0']
          }
        ];

使用插件

$('#cy').treeview({
       expandIcon: 'glyphicon glyphicon-chevron-right',
       collapseIcon: 'glyphicon glyphicon-chevron-down',
       levels: 1,
       showTags: true,
       data: defaultData
 });

官方文档

结果界面

bootstrap-treeview展示树形用户数据_第1张图片
tup.png

你可能感兴趣的:(bootstrap-treeview展示树形用户数据)