开源一个vue2的tree组件
github 地址 vue-tree
How to run demo
npm install
npm run dev
效果图
示例
<template>
<div style="width:300px;">
<tree ref ='tree' :treeData="treeData" :options="options" @node-click='handleNode'/>
</div>
</template>
<script>
import Tree from '../components/tree/tree.vue'
export default {
name: 'test',
data () {
return {
options: {
showCheckbox: true,
search: {
useInitial: true,
useEnglish: false,
customFilter: null
}
},
treeData: [
{
id: 1,
label: '一级节点',
open: true,
checked: false,
parentId: null,
visible: true,
searched: false,
children: [
{
id: 2,
label: '二级节点-1',
checked: false,
parentId: 1,
searched: false