Giter VIP home page Giter VIP logo

vue-tree-view's Introduction

Tree View Component (for Vue)

GitHub version Bower version

Tree view component for Vue Js.

Demo

Demo (with Bootstrap)

Demo (with customized CSS)

Package index

Installation

Several installation options are available:

Usage

Add the following resources for the tree view to function correctly.

<!-- Required Stylesheets -->
<link href="[component path]/dist/vue.tree-view.min.css" rel="stylesheet">

<!-- Required Javascript -->
<script src="vue.js"></script>
<script src="[component path]/dist/vue.tree-view.min.js"></script>

Add the component in your vue view.

<!-- Assuming your view app is APP. -->
<body id="app">

    <treeview :value.sync="value"
        :model="treeData"
    ></treeview>

</body>

Where:

  • model is the tree data within your vue model.
  • value is the selected value in the tree you want to bind with your model.

Props

List of available props to use in component:

Prop Data Type Default Description
model Array [] Tree data.
value String or Numeric Tree's selected value.
class String CSS Class to add to treeview.
children String nodes Name of the property in the tree that contains child nodes.
labelname String label Name of the property in the tree that contains the node's label.
valuename String value Name of the property in the tree that contains the node's value.

Usage example (Demo):

<body id="app">

    <treeview :value.sync="id"
        :model="users"
        class="form-control"
        labelname="name"
        valuename="id"
    ></treeview>

</body>
new Vue({
    el: '#app',
    data: {
        id: undefined, // Binded to component.
        users: [
            {
                name: 'John',
                id: 1
            },
            {
                name: 'Jane',
                id: 2
            }
        ],
    }, 
});

Events

List of available events to use in component:

Event Passes Description
treeview_click node: Selected node Triggered when a node is clicked.

Usage example (Demo):

new Vue({
    el: '#app',
    events: {
        'treeview_click': function(node) {
            // TODO my code here
            console.log(node.label);
            console.log(node.value);
        }
    }, 
});

License

Copyright (c) 2016 10Quality. Under MIT License.

vue-tree-view's People

Contributors

amostajo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.