Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
allow-batch
whole-row
draggable
expand-timer
:expand-timer-time-out="5000"
execute-sibling-movement
:multi-tree="multiTree"
@item-click="itemClick"
@item-drag-start="itemDragStart"
@item-drag-end="itemDragEnd"
Expand All @@ -26,6 +30,10 @@
<span style="float: left; background-color: red; color: #fff; padding: 6px" draggable="true">
drag me to add new child !
</span>
<input type="checkbox" id="multiTreeFlag"
v-model="multiTree"
value=true>Enable multiTree<br>

</div>
<div style="width:50%; display:inline-block;">
<textarea style="height:300px; width:100%;">
Expand Down Expand Up @@ -191,6 +199,7 @@
editingItem: {},
editingNode: null,
itemEvents: {

mouseover: function () {
console.log('mouseover')
},
Expand Down Expand Up @@ -375,7 +384,8 @@
{"text": "root"}
],
filesToAdd: 1,
filesToAddIndex: 0
filesToAddIndex: 0,
multiTree:false
}
},
methods: {
Expand Down
227 changes: 0 additions & 227 deletions README-CN.md

This file was deleted.

34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
# vue-jstree

[![npm](https://img.shields.io/npm/dt/vue-jstree.svg?style=flat-square)](https://github.com/zdy1988/vue-jstree)
[![npm](https://img.shields.io/npm/dt/vue-jstree.svg?style=flat-square)](https://github.com/shpfive/vue-jstree)

[English](./README.md)/[中文](./README-CN.md)
[English](./README.md)

## Introduction

A tree plugin for vue2
Its a fork of original vue-jstree plugin by zdy1988

https://github.com/zdy1988/vue-jstree

A tree plugin for vue2, extended with new functions,
like <br>expand-timers, resibling nodes logic and much more

<img src="./pic.png" width="100%" align=center />

## DEMO

[http://zdy1988.github.io/vue-jstree](http://zdy1988.github.io/vue-jstree)

## NPM

```html
npm install vue-jstree
npm install vue-jstree-extended
```

## ES6
Expand All @@ -42,7 +45,7 @@ A tree plugin for vue2
## Usage

```html
<v-jstree :data="data" show-checkbox multiple allow-batch whole-row @item-click="itemClick"></v-jstree>
<v-jstree :data="data" expand-timer :expand-timer-time-out="5000" execute-sibling-movement multi-tree show-checkbox multiple allow-batch whole-row @item-click="itemClick"></v-jstree>

new Vue({
data: {
Expand Down Expand Up @@ -147,6 +150,12 @@ A tree plugin for vue2
| draggable | Boolean | false | set tree item can be dragged , selective drag and drop can set 'dragDisabled: true' and 'dropDisabled: true' , all default value is 'false' |
| drag-over-background-color | String | '#C9FDC9' | set drag over background color |
| klass | String | | set append tree class |
| expand-timer | Boolean | false | prop to control expanding of nodes during dragOver |
| expand-timer-time-out | Number | 1500 | prop to control duration of expanding timer |
| execute-siblings-movement | Boolean | false | prop to control siblings movement: if true -> move node and emit event, false -> just emit event, and let user decide what to do with it |
| multi-tree | Boolean | false | prop to define in which mode tree is working - usual or multiTree |
| show-drop-postion | Boolean | true | prop to define show or not the tree marker |
| allow-multi-tree-and-usual | Boolean | false | prop to define act both behavior for multiTree and usual |

## Methods in node.model

Expand All @@ -157,7 +166,10 @@ A tree plugin for vue2
| addBefore | (object) newDataItem, (object) selectedNode |
| openChildren | |
| closeChildren | |

| moveTo | (object)draggedItem, (object)anchorNode|
| moveLeftTo | (object)draggedItem, (object)anchorNode, oriIndex|
| moveRightTo | (object)draggedItem, (object)anchorNode, oriIndex|
| deleteNode | (object)selectedNode|
## Event

**@item-click(node, item, e)**
Expand All @@ -178,6 +190,12 @@ A tree plugin for vue2

**e** : event

**@item-drop-sibling-left**: move dragged node to left of target

**@item-drop-sibling-right**: move dragged node to right of target

**@item-drop-multi-tree**: dropped on node in multiTree mode

## Data Item Optional Properties

| Name | Type | Default | Describe |
Expand Down
2 changes: 1 addition & 1 deletion dist/vue-jstree.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vue-jstree.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
<meta charset="utf-8">
<title>vue-jstree</title>
<link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

</head>
<body>
<div id="app"></div>
<div id="app">

</div>
<script src="/dist/vue-jstree.js"></script>
</body>
</html>
Loading