Press "Enter" to skip to content

Vue Treeview Structure Implementation In Javascript Dynamically

Vue-Tree is a VUE component that performs a TreeView control. Its goal is to provide shared tree options in an easy-to-use and easy to allocate.

hierarchical tree structure in html css, horizontal tree structure in html css, tree structure in javascript dynamically, tree view js, best react tree component

Create An ASCII Tree From The Folder Structure | tree-builder

How to make use of it:

Install and download:

# Yarn
$ yarn add @grapoza/vue-tree

# NPM
$ npm i @grapoza/vue-tree

1. Import the vue tree.

import TreeView from "@grapoza/vue-tree"

2. Register component.

export default {
  components: {
    TreeView
  }
}

3. Add a tree view component to the application template.

<template>
  <tree-view id="example" :initial-model="dataModel"></tree-view>
</template>

4. Add the contract to the tree view.

export default {
  components: {
    TreeView
  },
  data() {
    return {
      dataModel: [
        {id: "numberOrString", label: "Root Node", children: [
        {id: 1, label: "Child Node"},
        {id: 2, label: "Second Child"}]
        }
      ]
    }
  }
}

5. All virtual tree props.

initialModel: {
  type: Array,
  required: true
},
modelDefaults: {
  type: Object,
  required: false,
  default: function () { return {}; }
},
selectionMode: {
  // none, 'single', 'selectionFollowsFocus', or 'multiple'
  type: String,
  required: false,
  default: SelectionMode.None,
  validator: function (value) {
    return Object.values(SelectionMode).includes(value);
  }
},
skinClass: {
  type: String,
  required: false,
  default: 'default-tree-view-skin',
  validator: function (value) {
    return value === null || !value.match(/\s/);
  }
}

Powerful Tree View Component, vue-tree Plugin/Github


See Demo And Download

Official Website(grapoza): Click Here

This superior jQuery/javascript plugin is developed by grapoza. For extra Advanced Usages, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.