1.2.7 • Published 6 years ago

vue-drag-sort-tree v1.2.7

Weekly downloads
32
License
-
Repository
-
Last release
6 years ago

tree github npm

A Vue.js component

Effect

1

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:9000
npm run dev

Install

npm install vue-drag-sort-tree --save

Basic Usage

// demo.Vue
<template>
<div class="hello">
  <div class="tree">
    <tree ref='tree' :treeData="treeData" :options="options"/>
  </div>
</template>

<script>
import Tree from 'vue-drag-sort-tree'
const tree = Tree();

export default {
  name: 'hello',
    components: { tree },
      data() {
        return {
         options: {
            sortKey: 'order',
            parentKey: 'parentId',
            childrenKey: "children",
          },
          treeData: [
            {
              id: 1,
              label: 'id: 1',
              order: 0,
              parentId: null,
              children: []
           }
          ]
    },
   methods: {
    getdata(){
      this.formated = this.$refs.tree.reformatData();
    }
  }
 }

Advantage Usage

// tpl.vue
<template>
  <span>{{data.id}}</span>
</template>

<script>
  export default {
    props: {
      d: [Object]
    },
    data() {
      return {
        data: {}
      }
    },
    mounted(){
      this.data = this.d;
    }
  }
</script>

Contact me

vimmingshe@gmail.com

1.2.7

6 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago