vue-quick-tree
Vue Quick Tree
A simple, straightforward and mostly unopininoted tree vue component.
Installation
npm i vue-quick-tree
In your main.ts file
import VueQuickTree from 'vue-quick-tree'
Vue.component('vue-quick-tree', VueQuickTree)
Usage
<template>
<vue-quick-tree v-model="tree">
<template #node="{ node }">
<span v-if="node.type === 'folder'">📁 {{ node.name }}</span>
<span v-else>{{ node.name }}</span>
</template>
</vue-quick-tree>
</template>
<script>
export default {
data() {
return {
tree: [
{
name: 'stuff'
type: 'folder'
children: [],
validator: (dropLocation, dragLocation) => {}
}
]
}
}
}
</script>
Props
Name | Type | Description |
---|---|---|
indentLevel | number | indent size of the node |
border | BorderConfig (see below) | indent line style |
allowDragNDrop | boolean | determines if drag n drop will enabled |
// BorderConfig
{
show: boolean;
type: 'dashed' | 'solid';
color: string;
width: number;
}
The expected structure is a recursive array. Feel free to add any thing property you want to add into the object.
Note: The children property is required to have the nested structure
Dependencies
@rollup/plugin-buble: ^0.21.3@rollup/plugin-commonjs: ^11.1.0@types/jest: ^24.0.19@typescript-eslint/eslint-plugin: ^4.18.0@typescript-eslint/parser: ^4.18.0@vue/cli-plugin-babel: ~4.5.0@vue/cli-plugin-eslint: ~4.5.0@vue/cli-plugin-router: ~4.5.0@vue/cli-plugin-typescript: ~4.5.0@vue/cli-plugin-unit-jest: ~4.5.0@vue/cli-plugin-vuex: ~4.5.0@vue/cli-service: ~4.5.0@vue/eslint-config-typescript: ^7.0.0@vue/test-utils: ^1.0.3eslint: ^6.7.2eslint-plugin-vue: ^6.2.2rollup: ^1.17.0rollup-plugin-typescript2: ^0.30.0rollup-plugin-vue: ^5.0.1sass: ^1.26.5sass-loader: ^8.0.2typescript: ~4.1.5vue-template-compiler: ^2.6.11