迁移成本可控
保留熟悉的 columns、排序、筛选、选择和 change 事件模型,适合从现有表格逐步迁移,而不是推倒重写。
保留熟悉的 columns、排序、筛选、选择和 change 事件模型,适合从现有表格逐步迁移,而不是推倒重写。
同一套表格模型里直接提供虚拟滚动、固定列和列宽拖拽,不需要再拆出另一套列表方案。
通过 themePreset、全局 theme、实例级 ui 三层分工管理样式,既能统一规范,也能保留局部例外。
同一套表格逻辑可以在 antdv 和 element-plus 两套视觉体系下接入,适合已有 Vue UI 生态项目。
striped、hoverable、bordered 等常见视觉状态都可以直接通过 props 或主题配置开启。
列类型、主题 key、slot key 和事件参数都有明确类型边界,适合在业务代码里长期维护。
<script setup lang="ts">
import { computed, ref } from 'vue'
import { VTable } from '@vtable-guild/vtable-guild'
import type { Key, RowSelection, TableColumnsType } from '@vtable-guild/vtable-guild'
interface ReleaseRow {
key: string
pkg: string
version: string
channel: string
size: number
downloads: number
publishedAt: string
}
const columns: TableColumnsType<ReleaseRow> = [
{ title: '包', dataIndex: 'pkg', key: 'pkg', width: 200, fixed: 'left', resizable: true },
{ title: '版本', dataIndex: 'version', key: 'version', width: 110 },
{
title: '通道',
dataIndex: 'channel',
key: 'channel',
width: 110,
filters: [
{ text: 'latest', value: 'latest' },
{ text: 'next', value: 'next' },
],
onFilter: (value, record) => record.channel === value,
},
{
title: 'gzip 体积',
dataIndex: 'size',
key: 'size',
width: 130,
align: 'right',
sorter: (a, b) => a.size - b.size,
customRender: ({ text }) => `${text} KB`,
},
{
title: '周下载',
dataIndex: 'downloads',
key: 'downloads',
width: 120,
align: 'right',
sorter: (a, b) => a.downloads - b.downloads,
defaultSortOrder: 'descend',
},
{ title: '发布时间', dataIndex: 'publishedAt', key: 'publishedAt', width: 150 },
]
const dataSource: ReleaseRow[] = [
{
key: '1',
pkg: '@vtable-guild/vtable-guild',
version: '2.3.0',
channel: 'latest',
size: 56,
downloads: 47,
publishedAt: '2026-07-14',
},
{
key: '2',
pkg: 'core(内部)',
version: '2.3.0',
channel: 'latest',
size: 18,
downloads: 0,
publishedAt: '2026-07-14',
},
{
key: '3',
pkg: 'theme(内部)',
version: '2.3.0',
channel: 'latest',
size: 9,
downloads: 0,
publishedAt: '2026-07-14',
},
{
key: '4',
pkg: 'table(内部)',
version: '2.4.0',
channel: 'next',
size: 31,
downloads: 0,
publishedAt: '2026-07-30',
},
{
key: '5',
pkg: 'icons(内部)',
version: '2.3.0',
channel: 'latest',
size: 3,
downloads: 0,
publishedAt: '2026-07-14',
},
]
const selectedRowKeys = ref<Key[]>(['1'])
const rowSelection = computed<RowSelection<ReleaseRow>>(() => ({
selectedRowKeys: selectedRowKeys.value,
onChange: (keys) => (selectedRowKeys.value = keys),
}))
</script>
<template>
<VTable
row-key="key"
bordered
striped
hoverable
:columns="columns"
:data-source="dataSource"
:row-selection="rowSelection"
:scroll="{ x: 920 }"
/>
<p style="margin-top: 12px; font-size: 13px; opacity: 0.7">
这是一张真表格:点表头排序、点漏斗筛选、勾选行、拖第一列的分隔线改宽度。
</p>
</template>想看更大的场景,去 10 万行虚拟滚动;想改代码即时看效果,去 Playground。
vtable-guild 面向已经在项目中使用 ant-design-vue 或 element-plus 的团队。
如果你希望保留熟悉的表格使用方式,但又需要更稳定的虚拟滚动、列宽控制、主题扩展和更可维护的样式覆盖模型,这个库比继续在原表格外堆补丁更合适。