├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── README_CN.md
├── bundle.css
├── data.json
├── dist
└── vue-trees.js
├── package.json
├── rollup.config.js
└── src
├── components
├── default.css
├── fold.css
├── index.vue
└── transition.js
├── images
├── afterMod.png
└── beforeMod.jpg
└── vue-trees.js
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.js linguist-language=vue
2 | *.css linguist-language=vue
3 | *.html linguist-language=vue
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 码上码下
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-trees
2 | a tree UI base on vue 2.X
3 |
4 | ### install
5 | ```
6 | npm install vue-trees --save
7 | or
8 | cnpm i vue-trees -S
9 | ```
10 |
11 | ### Quick start
12 | ```
13 | import Vue from 'vue'
14 | import vueTrees from 'vue-trees'
15 |
16 | Vue.use(vueTrees)
17 | ```
18 |
19 | ## API DOC ([中文文档](https://github.com/wyr1227/vue-trees/blob/master/README_CN.md))
20 |
21 | ### data Property
22 | The data property does not support properties inherited from the prototype chain (if you can use to consider whether the under-complex, it is recommended to check the code)
23 |
24 | | Param | Description | Types | Editable | Default value |
25 | |---------- |-------- |---------- |---------- |---------- |
26 | |title | Node name | String | - | — |
27 | |expanded | Whether the node is expanded | Boolean | Y | false |
28 | |checked | Node check box is selected | Boolean | Y | false |
29 |
30 | ### tree Property
31 | | Param | Description | Types | Editable | Default value |
32 | |---------- |-------- |---------- |---------- |---------- |
33 | |type | Tree style | String | Y | default |
34 | |canCheck | Node can choose | Boolean | Y | false |
35 | |draggable | Whether the node can drag | Boolean | Y | false |
36 | |dragAndExpanded | Whether to expand after dragging | Boolean | Y | true |
37 | |control | Add or delete trees | Boolean | Y | false |
38 | |isSolid | Whether it is solid | Boolean | Y | false |
39 | |banCheck | Prohibition of choice | Boolean | Y | false |
40 | |bgColor | Background color (default type is useless) | String | Y | #fff |
41 | |fontColor | Font color (default type is useless) | String | Y | #000 |
42 |
43 | ### node event
44 | | Param | Description | Types | Editable | Arguments |
45 | |---------- |-------- |---------- |---------- |---------- |
46 | |beforeAddNode | Increase the node before the trigger event (return 'no' means no new) | Function | Y | 1:Parent node |
47 | |afterAddNode | Increase the node after the trigger event | Function | Y | 1:Add node,2:Parent node |
48 | |beforeDelNode | Delete the node before the trigger event (return 'no' means do not delete) | Function | Y | 1:Current node |
49 | |afterAddNode | Event triggered after node deletion | Function | Y | 1:Current node |
50 | |beforeDragNode | Drag the node before the trigger event (return 'no' means do not drag) | Function | Y | 1:Drag node,2:Target node |
51 | |afterDragNode | Drag the node after the trigger event | Function | Y | 1:Drag node, 2:Target node |
52 |
53 | ### Demo
54 | ```
55 |
56 |
57 |
58 |
59 | 修改
60 |
61 |
62 |
63 |
132 |
133 |
158 |
159 | ```
160 | ### Example of effect
161 | #### If you can not see my picture please go my [github](https://github.com/wyr1227/vue-trees)
162 | #### If you find any problems during use please feel free to Issues
163 |
164 |
165 |
--------------------------------------------------------------------------------
/README_CN.md:
--------------------------------------------------------------------------------
1 | # vue-trees
2 | 一个基于Vue2.x的树形控件
3 |
4 | ### 安装
5 | ```
6 | npm install vue-trees --save
7 | 或者
8 | cnpm i vue-trees -S
9 | ```
10 |
11 | ### 快速开始
12 | ```
13 | import Vue from 'vue'
14 | import vueTrees from 'vue-trees'
15 |
16 | Vue.use(vueTrees)
17 | ```
18 |
19 | ## API 文档 ([英文文档](https://github.com/wyr1227/vue-trees/blob/master/README.md))
20 |
21 | ### data 属性
22 | data属性不支持从原型链上继承的属性(如果用到可以考虑下是否过于复杂,建议检查下代码)
23 |
24 | | 参数 | 说明 | 类型 | 可编辑 | 默认值 |
25 | |---------- |-------- |---------- |---------- |---------- |
26 | |title | 节点名称 | String | - | — |
27 | |expanded | 节点是否展开 | Boolean | Y | false |
28 | |checked | 节点复选框是否选中 | Boolean | Y | false |
29 |
30 | ### tree 属性
31 | | 参数 | 说明 | 类型 | 可编辑 | 默认值 |
32 | |---------- |-------- |---------- |---------- |---------- |
33 | |type | 树状图类型 | String | Y | default |
34 | |canCheck | 节点是否可以选择 | Boolean | Y | false |
35 | |draggable | 节点是否可拖拽 | Boolean | Y | false |
36 | |dragAndExpanded | 拖拽后是否展开 | Boolean | Y | true |
37 | |control | 对树进行增删 | Boolean | Y | false |
38 | |isSolid | 是否是实线 | Boolean | Y | false |
39 | |banCheck | 禁止选择 | Boolean | Y | false |
40 | |bgColor | 背景颜色(default类型下无用) | String | Y | #fff |
41 | |fontColor | 字体颜色(default类型下无用) | String | Y | #000 |
42 |
43 | ### node 事件
44 | | 参数 | 说明 | 类型 | 可编辑 | 参数 |
45 | |---------- |-------- |---------- |---------- |---------- |
46 | |beforeAddNode | 增加节点前触发事件(返回'no'表示不新增) | Function | Y | 1:父节点 |
47 | |afterAddNode | 增加节点后触发事件 | Function | Y | 1:新增节点,2:父节点 |
48 | |beforeDelNode | 删除节点前触发事件(返回'no'表示不删除) | Function | Y | 1:当前节点 |
49 | |afterAddNode | 删除节点后触发事件 | Function | Y | 1:当前节点 |
50 | |beforeDragNode | 拖拽节点前触发事件(返回'no'表示不拖拽) | Function | Y | 1:拖拽节点,2:目标节点 |
51 | |afterDragNode | 拖拽节点后触发事件 | Function | Y | 1:拖拽节点, 2:目标节点 |
52 |
53 | ### 实例
54 | ```
55 |
56 |