Gathering detailed insights and metrics for vue-giant-tree-3
Gathering detailed insights and metrics for vue-giant-tree-3
Gathering detailed insights and metrics for vue-giant-tree-3
Gathering detailed insights and metrics for vue-giant-tree-3
npm install vue-giant-tree-3
Typescript
Module System
Node Version
NPM Version
Vue (91.33%)
JavaScript (4.74%)
HTML (3.92%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
674 Stars
26 Commits
169 Forks
5 Watchers
2 Branches
1 Contributors
Updated on Jun 05, 2025
Latest Version
1.0.0
Package Id
vue-giant-tree-3@1.0.0
Unpacked Size
1.21 MB
Size
247.82 kB
File Count
10
NPM Version
8.5.5
Node Version
16.13.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
2
:deciduous_tree: 巨树:基于ztree封装的 Vue 树形组件,轻松实现海量数据的高性能渲染。
Vue2.x 版本在这
Vue 的数据监听机制决定了在大数据量场景下的渲染性能非常低下,基于 Vue 实现的常规树组件几乎无法胜任上万条数据的高性能渲染,在 IE 浏览器(即便是 IE11)中很容易导致页面卡死甚至浏览器崩溃。
不服气可以试试这份数据 big-tree.json
为了摆脱数据监听,只能放弃通过 Vue 渲染,采用常规 DOM 操作的方式。在这个领域ztree是当之无愧最成熟的方案,因此 vue-giant-tree 直接基于 ztree 做上层封装,以组件的形式将 ztree 的配置和事件暴露出来,使其可以方便的在 Vue 项目中安装使用。
vue-giant-tree 仅仅是给 ztree 套了一层 Vue 组件的壳,顺便提供了一套更现代化的皮肤,因为主打大数据量场景,所以取名巨树。
ztree 在性能优化方面已经做到了近乎极致,感谢 ztree 作者的工作,向您致敬!
1npm i vue-giant-tree-3 --save
注意:组件依赖 JQuery,务必在页面中提前加载 JQuery:
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
in script:
1import tree from "vue-giant-tree-3"; 2 3export default { 4 components: { 5 tree 6 }, 7 data() { 8 return { 9 nodes: [ 10 { id:1, pid:0, name:"随意勾选 1", open:true}, 11 { id:11, pid:1, name:"随意勾选 1-1", open:true}, 12 { id:111, pid:11, name:"随意勾选 1-1-1"}, 13 { id:112, pid:11, name:"随意勾选 1-1-2"}, 14 { id:12, pid:1, name:"随意勾选 1-2", open:true}, 15 { id:121, pid:12, name:"随意勾选 1-2-1"}, 16 { id:122, pid:12, name:"随意勾选 1-2-2"}, 17 { id:2, pid:0, name:"随意勾选 2", checked:true, open:true}, 18 { id:21, pid:2, name:"随意勾选 2-1"}, 19 { id:22, pid:2, name:"随意勾选 2-2", open:true}, 20 { id:221, pid:22, name:"随意勾选 2-2-1", checked:true}, 21 { id:222, pid:22, name:"随意勾选 2-2-2"}, 22 { id:23, pid:2, name:"随意勾选 2-3"} 23 ] 24 } 25 }, 26 methods: { 27 onClick(evt, treeId, treeNode) { 28 29 }, 30 onCheck(evt, treeId, treeNode) { 31 32 }, 33 handleCreated(ztreeObj) { 34 35 } 36 } 37 ...
in template:
1<tree 2 :nodes="nodes" 3 @onClick="onClick" 4 @onCheck="onCheck" 5 @onCreated="handleCreated" 6/>
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
setting | ztree 配置 | Object | {view: {showIcon: false}} |
nodes | ztree 数据 | Array | [] |
完全移植zTree API中callback
支持的事件,除了:
before
开头的事件。这类事件的主要作用是根据返回值决定是否阻止后续的on
事件,这种判断可以在on
事件中实现;当然,你也可以通过setting.callback.beforeXXX
自行配置onNodeCreated
事件。因为在大数据量下很耗性能,如果需要可以通过 setting.callback.onNodeCreated
自行传入onCreated
事件。每次实例初始化完成时触发,回调参数接收 ztree 实例,通过 ztree 实例可以使用所有实例方法事件名称 | 说明 |
---|---|
onAsyncError | 参考 zTree API |
onAsyncSuccess | 参考 zTree API |
onCheck | 参考 zTree API |
onClick | 参考 zTree API |
onCollapse | 参考 zTree API |
onDblClick | 参考 zTree API |
onDrag | 参考 zTree API |
onDragMove | 参考 zTree API |
onDrop | 参考 zTree API |
onExpand | 参考 zTree API |
onMouseDown | 参考 zTree API |
onMouseUp | 参考 zTree API |
onRemove | 参考 zTree API |
onRename | 参考 zTree API |
onRightClick | 参考 zTree API |
onCreated | 初始化渲染完成后触发,回调参数接收 ztree 实例 |
zTree 没有提供给整个实例更新数据的方法,vue-giant-tree 基于 Vue 的组件通信机制扩展实现了响应式数据特性,只要nodes
的值发生变化,ztree 实例就会随之更新。
项目 DEMO里演示了 vue-giant-tree 的响应式数据特性。
npm i
npm run serve
MIT
Copyright (c) 2019-present, 前端路上
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/26 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More