1.2.2 • Published 6 years ago
vue-sortable-tree v1.2.2
vue-sortable-tree
QQ交流群: 424580388
Install
vue version < 2.5
$ npm install vue-sortable-tree@1.1.0 --save [must < 1.2.0]
vue version >= 2.5
$ npm install vue-sortable-tree --save
Global register
import SortableTree from 'vue-sortable-tree'
Vue.component(SortableTree.name, SortableTree)
Partial register
import SortableTree from 'vue-sortable-tree'
// then in component
components: {
[SortableTree.name]: SortableTree
}
Usage
<template>
<sortable-tree :data="treeData">
<template slot-scope="{item}">
<span>{{item.name}}</span>
</template>
</sortable-tree>
</template>
Params
<sortable-tree :data="treeData" attr="name" childrenAttr="children" mixinParentKey="$parent" @changePosition="changePosition">
<template slot-scope="{item}">
<span>{{item.name}}</span>
</template>
</sortable-tree>
Property | Type | Default | Description |
---|---|---|---|
data | Object | - | Tree data source. |
attr | String | 'name' | A name of property in data source that will be display. |
childrenAttr | String | children | A name of property in data source that contain children node. |
mixinParentKey | String | '' | A name of property that contain parent data. |
closeStateKey | String | '' | A name of property to determine the open/close state. |
draggable | Boolean | true | Enable dragging the tree node. |
Event | Parameter | Description |
---|---|---|
changePosition | {beforeParent, data, afterParent} | Trigger when node position has been changed. |
依赖 sassscss support
if your project can't support scss please add below dependence
npm install node-sass --save-dev
npm install sass-loader --save-dev
Project demo image
You can design your style easily with custom template.
eg:
1.2.2
6 years ago
1.2.1
6 years ago
1.2.0
6 years ago
1.1.0
6 years ago
1.0.26
7 years ago
1.0.25
7 years ago
1.0.23
7 years ago
1.0.22
7 years ago
1.0.21
7 years ago
1.0.20
7 years ago
1.0.19
7 years ago
1.0.18
7 years ago
1.0.17
7 years ago
1.0.16
7 years ago
1.0.15
7 years ago
1.0.14
7 years ago
1.0.13
7 years ago
1.0.12
7 years ago
1.0.10
7 years ago
1.0.9
7 years ago
1.0.7
7 years ago
1.0.6
7 years ago
1.0.5
7 years ago
1.0.4
7 years ago
1.0.3
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago