
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
virtual-scroller-tree-vue2
Advanced tools
English | 中文
A tree component based on vue2.x that supports a small amount of data or a large amount of data, multiple functions, and virtual scrolling.
Based on the tree style and function extracted from element-ui(License:MIT), combined with vue-virtual-scroller(License:MIT) tree component.
npm install virtual-scroller-tree-vue2
or
yarn add virtual-scroller-tree-vue2
Import in the main.js file:
import Vue from "vue";
import VirtualScrollerTree from "virtual-scroller-tree-vue2";
// Style file, you can customize the style or theme according to your needs
import "virtual-scroller-tree-vue2/src/assets/index.scss"
Vue.use(VirtualScrollerTree)
Import in the component:
import VirtualScrollerTree from "virtual-scroller-tree-vue2";
// Style file, you can customize the style or theme according to your needs
import "virtual-scroller-tree-vue2/src/assets/index.scss"
export default {
components: {
VirtualScrollerTree
}
}
:warning: When using virtual scrolling, node-key must be set
<template>
<div class="ve-tree" style="height:calc(100vh - 20px)">
<!-- Just remove the height parameter when not using virtual scrolling -->
<virtual-scroller-tree
ref="veTree"
node-key="id"
height="calc(100vh - 20px)"
:data="treeData"
:props="props"
></virtual-scroller-tree>
</div>
</template>
<script>
export default {
data() {
return {
props: {
label: "name",
children: "children"
},
treeData: []
};
},
created() {
const data = [],
root = 8,
children = 3,
base = 1000;
for (let i = 0; i < root; i++) {
data.push({
id: `${i}`,
name: `test-${i}`,
children: []
});
for (let j = 0; j < children; j++) {
data[i].children.push({
id: `${i}-${j}`,
name: `test-${i}-${j}`,
children: []
});
for (let k = 0; k < base; k++) {
data[i].children[j].children.push({
id: `${i}-${j}-${k}`,
name: `test-${i}-${j}-${k}`
});
}
}
}
this.treeData = data;
}
};
</script>
By creating a new style file, such as: ve-tree-var.scss, write the following content:
/* Change theme color variable */
$--color-primary: #ea5404;
/* Change the icon font path variable, required */
$--font-path: "~virtual-scroller-tree-vue2/src/assets/fonts";
@import "virtual-scroller-tree-vue2/src/assets/index.scss";
:warning: It should be noted that it is necessary to override the font path variable, and assign it to the relative path where the icon icon in virtual-scroller-tree-vue2 is located.
Then directly import the above style files in main.js:
import Vue from 'vue'
import VirtualScrollerTree from "virtual-scroller-tree-vue2";
import "./css/ve-tree-var.scss"
Vue.use(VirtualScrollerTree)
From element-ui official document
When you need to use virtual scrolling, just add the height property, such as:
<virtual-scroller-tree :data="data" height="calc(100vh - 20px)" :props="defaultProps" @node-click="handleNodeClick"></virtual-scroller-tree>
Quick view of examples and api
FAQs
A Vue2 virtual scroller ElTree project
We found that virtual-scroller-tree-vue2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.