@tinywisp/vue-tree

1,018 14
Install
npm install @tinywisp/vue-tree
Latest Version:3.2.2
Vue:3
License:MIT
Last Updated:Dec 13, 2023
Links: GitHub  ·  npm
Maintainer: tinywisp

VueTree

GitHub npm codecov

基于vue3的树形组件。

A highly customizable tree component for vue3.

主要特色

  • 支持复选框
  • 可异步加载
  • 拖放操作
  • 右键菜单
  • 按钮
  • 自定义外观
  • 触屏支持

文档

开始使用

npm

  npm install @tinywisp/vue-tree --save

引入

  import VueTree from '@tinywisp/vue-tree'

示例

<template>
 <div id="app">
   <vue-tree :tree="tree" ref="tree" class="tree" />
 </div>
</template>

<script>
import VueTree from '@tinywisp/vue-tree'

export default {
 name: 'App',
 components: {
   VueTree
 },
 data() {
   return {
     tree: [
       {
         id: 1,
         title: 'ROOT',
         hasChild: true,
         children: [
           {
             id: 2,
             title: 'child 1',
           },
           {
             id: 3,
             title: 'child 2',
             hasChild: true,
             children: [
               {
                 id: 4,
                 title: 'child 2-1'
               },
               {
                 id: 5,
                 title: 'child 2-2'
               },
               {
                 id: 6,
                 title: 'child 2-3'
               }
             ],
           },
           {
             id: 7,
             title: 'child 3'
           },
           {
             id: 8,
             title: 'child 4'
           }
         ]
       }
     ]
   }
 }
}
</script>

<style scoped>
.tree {
 width: 200px;
 height: 300px;
}
</style>

示例

开源协议

  • MIT
  • 无论个人还是公司,都可以免费自由使用

vue2


Features

  • checkbox
  • async loading
  • drag and drop
  • context menu
  • button
  • customizable appearance
  • touch support

Getting Started

npm

  npm install @tinywisp/vue-tree --save

import the library

  import VueTree from '@tinywisp/vue-tree'

usage

<template>
 <div id="app">
   <vue-tree :tree="tree" ref="tree" class="tree" />
 </div>
</template>

<script>
import VueTree from '@tinywisp/vue-tree'

export default {
 name: 'App',
 components: {
   VueTree
 },
 data() {
   return {
     tree: [
       {
         id: 1,
         title: 'ROOT',
         hasChild: true,
         children: [
           {
             id: 2,
             title: 'child 1',
           },
           {
             id: 3,
             title: 'child 2',
             hasChild: true,
             children: [
               {
                 id: 4,
                 title: 'child 2-1'
               },
               {
                 id: 5,
                 title: 'child 2-2'
               },
               {
                 id: 6,
                 title: 'child 2-3'
               }
             ],
           },
           {
             id: 7,
             title: 'child 3'
           },
           {
             id: 8,
             title: 'child 4'
           }
         ]
       }
     ]
   }
 }
}
</script>

<style scoped>
.tree {
 width: 200px;
 height: 300px;
}
</style>

Document

Demos

License

  • MIT
  • it is free for commercial use.

vue 2

Related Packages

liquor-tree

A Vue.js tree component.

222,635 392
liquor-tree-vue3

A Vue.js tree component.

21,118
@widgetjs/tree

a lightweight tree widget, compatible with originaljs/react/vue, 9.6kb size for...

79,956 160
vue-jstree

a tree plugin for vue2

137,015 630
vue-okr-tree

一个特殊布局模式结构的`vue Tree`组件

3,749 650

Version History

Version Released Vue License
3.2.2 ^3.2.36 MIT
3.2.1 ^3.2.36 MIT
3.2.0 ^3.2.36 MIT
3.1.0 ^3.2.36 MIT
3.0.0 ^3.2.36 MIT