GithubHelp home page GithubHelp logo

joweiblog / vue-decision-tree Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 0.0 302 KB

🧐Simple decision tree / relationship tree component, for VueJS.

License: MIT License

JavaScript 23.11% HTML 2.77% Vue 40.95% Shell 0.93% SCSS 32.23%
vue-decision-tree vuejs tree

vue-decision-tree's Introduction

vue-decision-tree

🧐Simple decision tree / relationship tree component, for VueJS.

Mainly relies on CSS Flexible Box. See compatibility: https://caniuse.com/#search=Flexible

Live demo here

Install:

npm i vue-decision-tree -S

Use:

<template>
  <div>
    <decision-tree :data="mockData"/>
    
    <!-- <decision-tree
      :data="mockData"
      #default="{ node, data }"
    >
      <template>
        <span>{{ data.label }}</span>
      </template>
    </decision-tree> -->
  </div>
</template>

<script>
  import DecisionTree from 'vue-decision-tree'
  
  export default {
    components: { DecisionTree },

    data() {
      return {
        mockData: [
          {
            label: '1',
            children: [{ label: '12' }, { label: '13' }],
          },
        ],
      }
    },
  }
</script>

props

Props Type Description
data Array data
hSpacing Number horizontal spacing, defaults to 16 (px)
vSpacing Number vertical spacing, defaults to 48 (px)
lineColor String defaults to #000
direction String options: ltr / rtl / ttb / btt, defaults to ltr
props Object defaults to { children: 'children', label: 'label' }

slot

Props Description
- Custom content for the node, the scope parameter is { node, data }

vue-decision-tree's People

Contributors

joweiblog avatar

Stargazers

Julien Langlois avatar Dan Sikes avatar Joseph Luk avatar Pape Ventures avatar Stefan Bauer avatar Ryoichi avatar Leonardo Cavalcante avatar davidturtle avatar  avatar Tim Maier avatar

Watchers

James Cloos 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.