npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zjinh/vue-virtual-tree

v2.0.0

Published

A virtual tree component for Vue 2.7 and Vue 3

Readme

English | 简体中文

@zjinh/vue-virtual-tree

npm version

一个同时支持 Vue 2.7 与 Vue 3 的固定行高虚拟树组件。它通过只挂载视口内的行来处理大规模树数据,并提供复选、当前节点、过滤、懒加载、数据修改方法和自定义行内容等常用能力。

包格式为 ESM。Vue 2.7 与 Vue 3 都使用 @zjinh/vue-virtual-tree 根入口。公共样式从 @zjinh/vue-virtual-tree/style.css 导入。

兼容性

| 运行时 | 支持版本 | 导入入口 | | --- | --- | --- | | Vue 2 | 仅 Vue 2.7.x | @zjinh/vue-virtual-tree | | Vue 3 | Vue 3 >= 3.2 | @zjinh/vue-virtual-tree |

不支持 Vue 2.6。组件仅提供 @zjinh/vue-virtual-tree 一个入口,已移除 /vue2 和 /vue3 包子路径。无需安装 vue-demi 或运行版本切换脚本。

在线演示

安装

选择一种包管理器:

pnpm add @zjinh/vue-virtual-tree
npm install @zjinh/vue-virtual-tree
yarn add @zjinh/vue-virtual-tree

在应用中安装 Vue 2.7.x 或 Vue 3 >= 3.2,两个版本均使用根入口。

Vue 3 快速开始

在 main.ts 中注册组件:

import { createApp } from 'vue'
import VueVirtualTree from '@zjinh/vue-virtual-tree'
import '@zjinh/vue-virtual-tree/style.css'
import App from './App.vue'

createApp(App).use(VueVirtualTree).mount('#app')

然后渲染一棵树:

<script setup lang="ts">
interface DemoNode {
  id: number
  label: string
  children?: DemoNode[]
}

const data: DemoNode[] = [{
  id: 1,
  label: 'Root',
  children: [
    { id: 2, label: 'First child' },
    { id: 3, label: 'Second child' },
  ],
}]
</script>

<template>
  <VueVirtualTree
    :data="data"
    :height="320"
    node-key="id"
    :default-expanded-keys="[1]"
  ></VueVirtualTree>
</template>

如果要局部注册,导入同一组件并添加 components: { VueVirtualTree }。

Vue 2.7 快速开始

在 main.ts 中使用同一个根入口:

import Vue from 'vue'
import VueVirtualTree from '@zjinh/vue-virtual-tree'
import '@zjinh/vue-virtual-tree/style.css'
import App from './App.vue'

Vue.use(VueVirtualTree)
new Vue({ render: (h) => h(App) }).$mount('#app')

组件可以配合 Vue 2.7 Options API 使用:

<script lang="ts">
interface DemoNode {
  id: number
  label: string
  children?: DemoNode[]
}

export default {
  data(): { data: DemoNode[] } {
    return {
      data: [{
        id: 1,
        label: 'Root',
        children: [{ id: 2, label: 'Child' }],
      }],
    }
  },
}
</script>

<template>
  <VueVirtualTree
    :data="data"
    :height="320"
    node-key="id"
  ></VueVirtualTree>
</template>

如果要局部注册,请导入同一个组件并添加 components: { VueVirtualTree }。

详细文档

  • 使用指南:尺寸设置、大数据、复选与当前节点、过滤、懒加载、slot 和 ref 方法。
  • API 参考:props、方法、事件、slot 参数、导出类型和运行限制。

开发

pnpm install --frozen-lockfile
pnpm run dev:vue2
pnpm run dev:vue3
pnpm test
pnpm run build

许可证

MIT