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

admin-pro-table

v1.0.13

Published

Vue 3 + Element Plus 管理后台表格组件库

Readme

Admin Pro Table

Vue 3 + Element Plus 管理后台表格与表单组件库。集成搜索、表格、分页与增删改,通过配置即可完成常见 CRUD 列表页;表格与表单均支持 Element Plus 全部属性,并支持全局配置。

特性

  • ProTable:搜索表单 + 表格 + 分页 + 工具栏(添加/删除/返回),内置列表请求、分页、多选与操作列
  • 表单弹层:配置化 FormPopup,支持弹窗 / 抽屉 / 整页三种模式,与 ProTable 联动新增/编辑/复制
  • 全局配置:表格(tableProps)、表单(formConfig)、搜索(searchFormConfig)、分页(footerConfig)等可在 main.js 统一配置,单表/单表单可覆盖
  • Element 全属性:表格通过 tableProps、表单通过 formAttrs 透传,支持 Element Plus TableForm 全部属性

安装

pnpm add admin-pro-table
# npm install admin-pro-table
# yarn add admin-pro-table

依赖:需已安装 Vue 3、Element Plus、@element-plus/icons-vue(版本见 peerDependencies)。

快速开始

入口文件注册并引入样式:

import { createApp } from 'vue'
import ProTable from 'admin-pro-table'
import 'admin-pro-table/dist/style.css'
import App from './App.vue'

const app = createApp(App)
app.use(ProTable)

页面中使用,通过 search-configtable-configform-config 传入配置:

<template>
  <pro-table
    :search-config="searchConfig"
    :table-config="tableConfig"
    :form-config="formConfig"
  />
</template>

<script setup>
const searchConfig = {
  model: { name: '', status: '' },
  fields: [
    { label: '姓名', key: 'name', component: 'input', placeholder: '请输入' },
    { label: '状态', key: 'status', component: 'select', options: [{ label: '启用', value: 1 }, { label: '禁用', value: 0 }] }
  ]
}

const tableConfig = {
  requestConfig: { listApi: (params) => fetchList(params) },
  columns: [
    { label: '姓名', key: 'name' },
    { label: '状态', key: 'status' }
  ]
}

const formConfig = {
  fields: [
    { label: '姓名', key: 'name', component: 'input', placeholder: '请输入' },
    { label: '状态', key: 'status', component: 'select', options: [{ label: '启用', value: 1 }, { label: '禁用', value: 0 }] }
  ],
  add: { requestApi: addApi },
  edit: { requestApi: updateApi }
}
</script>

全局配置

安装时传入第二参数,可统一表格样式、表单默认、分页与接口约定等:

app.use(ProTable, {
  defaultPageSize: 20,
  pageKey: 'page',
  pageSizeKey: 'pageSize',
  responseFormat: (res) => ({ list: res?.data?.list ?? [], total: res?.data?.total ?? 0 }),
  footerConfig: { showPagination: true, showRefresh: true, pageSizes: [10, 20, 50, 100] },
  tableProps: { border: true, stripe: true, size: 'default' },
  formConfig: { labelWidth: '100px', labelPosition: 'right', formAttrs: { size: 'default' } },
  searchFormConfig: { labelWidth: '100px', gutter: 20, span: 8 },
  successCode: 1,
  codeKey: 'code',
  messageKey: 'msg'
})

| 配置项 | 说明 | |--------|------| | tableProps | 表格默认属性,支持 Element Table 全部属性,单表 tableConfig.tableProps 覆盖 | | formConfig | 表单默认(labelWidth、labelPosition、formAttrs、span、uploadConfig 等),单表单覆盖 | | searchFormConfig | 搜索表单默认(labelWidth、gutter、span、uploadConfig 等),单表 searchConfig 覆盖 | | footerConfig | 底栏分页(show、showPagination、showRefresh、pageSizes、paginationLayout) | | responseFormat | 列表接口返回格式化 (res) => ({ list, total }) | | successCode / codeKey / messageKey | 表单提交成功后用于解析并提示的字段 |

配置说明

  • searchConfig:搜索区域(model、fields、span、collapse、defaultCollapsed 等),fields 与表单字段结构一致
  • tableConfig:requestConfig(listApi、params、pageKey、responseFormat)、columns、tableProps、rowKey、selection、deleteConfig、footerConfig、toolbarConfig、operationColumn 等
  • formConfig:mode(dialog/drawer/page)、fields、formAttrs、add/edit/save(requestApi、rules、paramsFormat)、uploadConfig 等

通过 ref 可调用:refresh()reset()getTableData()getSelectedRows()getPagination()getSearchParams()openAdd()。事件:@back(工具栏返回按钮)。

License

MIT