Secondary encapsulation of element-plus Table, providing flexible configuration items
English | 简体中文
element-plus
TableTable-column
attribute can only be written in the<template></template>
template at present, which is not very flexible. If the table has enoughcolumn
, the code is written and looks bloated, butelement-plus
Virtualized Table The configurability is very high. In order to maintain unity, I encapsulatedTable
twice and usedcellRenderer
,headerRenderer
These two custom renderers, Built-inPagination
component that can be rendered by configuration, of course, there are some additional properties, let's explore together
- 🦾 High flexibility: Written using
tsx
syntax, while ensuring the type, it provides developers with more flexible writing methods and provides users with more convenient configuration - ⚡ Fully tree-shaking: Comes with Tree-shaking, only packages the imported code
- 🫶 Code Zero Intrusion: While keeping all
properties
,slot
,events
andmethods
ofelement-plus
Table, Provides more flexible configuration, It also has built-inPagination
components that can be rendered by configuration - ⚓ Verification before code submission: Use husky to verify the rules before submitting code, enforce standard development process and prevent development mistakes
npm install @pureadmin/table
or
pnpm add @pureadmin/table
import { PureTable } from "@pureadmin/table";
<pure-table :data="dataList" :columns="columns" :pagination="pagination"></pure-table>
import { createApp } from "vue";
import App from "./App.vue";
import Table from "@pureadmin/table";
const app = createApp(App);
app.use(Table).mount("#app");
Click to view the specific usage
- If you are using
Volar
, you can configure compilerOptions.types in tsconfig.json to specify the global component type (especially if you want to get type hints during global registration, you need to add the following configuration)
// tsconfig.json
{
"compilerOptions": {
// ...
"types": ["@pureadmin/table/volar"]
}
}