Recently due to the needs of the background management project, the page needs to make an infinite tree needs, I first thought of the plugin ztree, but I think it is too big, or self-clothed it.
Ztree's demo address: http://www.treejs.cn/v3/demo.php
I brought the Ztree style library, I wrote the algorithm, the whole of a small and beautiful vue-ztree components, it basically can meet my business needs, I also hope to benefit the open source community, I intend to open it up.
Profile:
1:vue-ztree's
How 2:vue-ztree is called
The technical point of 3:vue-ztree
4:vue-ztree's Open Source address
1:vue-ztree's
The Vue-ztree effect, as shown in:
Figure one: Figure II:
2:vue-ztree Method of Invocation:
component notation, such as:
Vue-ztree's parameter explanation:
Parameters |
Type |
Default value |
Describe |
List |
Array |
- |
Structure data sources for trees |
Func |
Function |
- |
Click the node callback method |
Is-open |
Bealoon |
True |
Whether to expand the tree |
3. Technical points of Vue-ztree
The technical point of Vue-ztree is mainly the use of recursive algorithms, and some clever coding techniques.
Recommended Understanding Vue Component Tree recursive knowledge, address : Https://github.com/vuejs/vue/tree/dev/examples/tree
4. Vue-ztree's Open Source address
Open Source Address: https://github.com/lisiyizu/vue-ztree, welcome to fork, suggestions.
Installation Run steps:
1:NPM Install
2:NPM Run Dev
See the effect of running
Original "Open source a tree-level component Vue-ztree written in Vue"