ez-tables

Vue3 + Element Plus table components (Table, TableActionDropdown & TableQueryWrap)
1,417
Install
npm install ez-tables
Latest Version:0.1.8
Vue:3
License:MIT
Last Updated:Sep 11, 2026
Links: npm
Maintainer: youfather

ez-tables

基于 Vue 3 + Element Plus 的表格组件库,提供 Table、TableActionDropdown、TableQueryWrap 与 useTable。

安装

npm install ez-tables
# 或
pnpm add ez-tables

需同时安装 peer 依赖:

npm install vue element-plus @element-plus/icons-vue

使用

import { Table, TableActionDropdown, TableQueryWrap } from 'ez-tables'
import { useTable } from 'ez-tables/hooks'
import type { TableExpose, TableColumn } from 'ez-tables'
import 'element-plus/dist/index.css'

组件样式会随 ez-tables 自动注入,不必再写 import 'ez-tables/style.css'。

<template>
  <Table
    :columns="columns"
    :data="tableObject.tableList"
    :loading="tableObject.loading"
    :pagination="pagination"
    v-model:current-page="tableObject.currentPage"
    v-model:page-size="tableObject.pageSize"
    @register="register"
  >
    <template #action="{ row }">
      <TableActionDropdown
        :buttons="[
          { text: '编辑', type: 'primary', link: true, onClick: () => onEdit(row) },
          { text: '删除', type: 'danger', link: true, onClick: () => onDelete(row) }
        ]"
      />
    </template>
  </Table>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { Table, TableActionDropdown, TableQueryWrap } from 'ez-tables'
import { useTable } from 'ez-tables/hooks'
import type { Pagination } from 'ez-tables'

const getListApi = async (option: { pageNo: number; pageSize: number }) => {
  const res = await fetchList(option)
  return { list: res.list, total: res.total }
}

const { register, tableObject, methods } = useTable({ getListApi })

const pagination = computed<Pagination>(() => ({
  total: tableObject.total
}))
</script>

useTable 的用法与原来 import { useTable } from '@/hooks/web/useTable' 对齐:返回 register、tableObject、methods / tableMethods。删除、导出文案会优先使用项目里的 $t;没有 i18n 时使用中文默认文案。导出 Excel 也可通过 downloadExcel 自行接管。

全局注册(可选)

import EzTables from 'ez-tables'

app.use(EzTables)

本地开发

# 进入包目录
cd ez-tables

# 启动 playground
pnpm dev

# 构建
pnpm build

发布

pnpm build
npm publish --access public

Related Packages

element-plus-table-dragable

A directive what used sortablejs to add drag support for element-plus's table co...

19,522 14
@gits-id/table

GITS DataTable Table Component

3,591
@femessage/el-data-table

base on element-ui, makes crud easily

2,768 480
vue-data-tablee

A very simple table component.

2,441 42
el-table-jsx

文档地址

2,079 5

Version History

Version Released License
0.1.8 MIT
0.1.7 MIT
0.1.6 MIT
0.1.5 MIT
0.1.4 MIT