vue-easytable
A powerful data table based on vuejs. You can use it as data grid、Microsoft Excel or Google sheets. It supports virtual scroll、cell edit etc.
Top Related Projects
:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin
A Vue.js 2.0 UI Toolkit for Web
🐉 Vue Component Framework
A high quality UI Toolkit built on Vue.js 2.0
🌈 An enterprise-class UI components based on Ant Design and Vue. 🐜
Lightweight UI components for Vue.js based on Bulma
Quick Overview
Vue-easytable is a powerful and feature-rich table component for Vue.js applications. It offers a wide range of functionalities including sorting, filtering, pagination, and column resizing, making it an excellent choice for developers looking to implement complex data tables in their Vue projects.
Pros
- Comprehensive set of features for data table management
- Highly customizable with numerous configuration options
- Good documentation and examples for easy implementation
- Regular updates and active maintenance
Cons
- Learning curve might be steep for beginners due to extensive API
- Large bundle size compared to simpler table components
- Some advanced features may require additional setup
- Limited built-in themes and styling options
Code Examples
- Basic table setup:
<template>
<ve-table :columns="columns" :table-data="tableData" />
</template>
<script>
import { VeTable } from 'vue-easytable'
export default {
components: { VeTable },
data() {
return {
columns: [
{ field: 'name', key: 'name', title: 'Name' },
{ field: 'age', key: 'age', title: 'Age' },
],
tableData: [
{ name: 'John', age: 30 },
{ name: 'Jane', age: 25 },
],
}
},
}
</script>
- Implementing sorting:
<template>
<ve-table
:columns="columns"
:table-data="tableData"
:sort-option="sortOption"
/>
</template>
<script>
export default {
data() {
return {
// ... other data
sortOption: {
sortAlways: true,
sortChange: this.sortChange,
},
}
},
methods: {
sortChange(params) {
console.log('Sort changed:', params)
},
},
}
</script>
- Adding pagination:
<template>
<div>
<ve-table :columns="columns" :table-data="tableData" />
<ve-pagination
:total="total"
:page-index="pageIndex"
:page-size="pageSize"
@on-page-number-change="pageNumberChange"
@on-page-size-change="pageSizeChange"
/>
</div>
</template>
<script>
import { VeTable, VePagination } from 'vue-easytable'
export default {
components: { VeTable, VePagination },
data() {
return {
// ... other data
total: 100,
pageIndex: 1,
pageSize: 10,
}
},
methods: {
pageNumberChange(pageIndex) {
this.pageIndex = pageIndex
// Fetch data for the new page
},
pageSizeChange(pageSize) {
this.pageSize = pageSize
// Update data with new page size
},
},
}
</script>
Getting Started
-
Install the package:
npm install vue-easytable
-
Import and use in your Vue component:
<template> <ve-table :columns="columns" :table-data="tableData" /> </template> <script> import { VeTable } from 'vue-easytable' import 'vue-easytable/libs/theme-default/index.css' export default { components: { VeTable }, data() { return { columns: [ { field: 'name', key: 'name', title: 'Name' }, { field: 'age', key: 'age', title: 'Age' }, ], tableData: [ { name: 'John', age: 30 }, { name: 'Jane', age: 25 }, ], }
Competitor Comparisons
:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin
Pros of vue-element-admin
- Comprehensive admin panel solution with rich features and components
- Extensive documentation and examples for easy implementation
- Large and active community support
Cons of vue-element-admin
- Steeper learning curve due to its complexity and extensive features
- Potentially heavier and slower performance for simpler projects
- More opinionated structure, which may limit flexibility in some cases
Code Comparison
vue-element-admin:
<template>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="date" label="Date" width="180" />
<el-table-column prop="name" label="Name" width="180" />
<el-table-column prop="address" label="Address" />
</el-table>
</template>
vue-easytable:
<template>
<ve-table :columns="columns" :table-data="tableData" />
</template>
The vue-element-admin example shows a more verbose and customizable table structure, while vue-easytable offers a more concise and simplified approach. vue-element-admin provides granular control over table columns and styling, which can be beneficial for complex layouts but may require more code for basic implementations. In contrast, vue-easytable's approach is more straightforward and requires less boilerplate, making it potentially easier to use for simpler table needs.
A Vue.js 2.0 UI Toolkit for Web
Pros of element
- More comprehensive UI component library with a wider range of components
- Larger community and more frequent updates
- Better documentation and examples
Cons of element
- Larger bundle size due to the extensive component library
- Steeper learning curve for beginners
- Less focused on table functionality compared to vue-easytable
Code Comparison
element table example:
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="date" label="Date" width="180"></el-table-column>
<el-table-column prop="name" label="Name" width="180"></el-table-column>
<el-table-column prop="address" label="Address"></el-table-column>
</el-table>
vue-easytable example:
<ve-table :columns="columns" :table-data="tableData" />
The element table requires more verbose markup, while vue-easytable offers a more concise syntax for basic table implementation. However, element provides more built-in customization options directly in the template.
🐉 Vue Component Framework
Pros of Vuetify
- Comprehensive UI component library with a wide range of pre-built components
- Material Design-based, offering a polished and modern look out of the box
- Extensive documentation and active community support
Cons of Vuetify
- Larger bundle size due to its comprehensive nature
- Steeper learning curve for customization and overriding default styles
- May be overkill for projects that only need table functionality
Code Comparison
vue-easytable:
<template>
<vue-table
:columns="columns"
:table-data="tableData"
:sort-option="sortOption"
/>
</template>
Vuetify:
<template>
<v-data-table
:headers="headers"
:items="desserts"
:sort-by="sortBy"
:sort-desc="sortDesc"
></v-data-table>
</template>
Both libraries offer similar table functionality, but Vuetify provides a more comprehensive set of UI components beyond just tables. vue-easytable is more focused on table-specific features and may be lighter-weight for projects that only require table functionality. Vuetify's Material Design approach ensures a consistent look across all components, while vue-easytable allows for more flexibility in styling. The choice between the two depends on the specific needs of your project and whether you require a full UI framework or a specialized table solution.
A high quality UI Toolkit built on Vue.js 2.0
Pros of iview
- More comprehensive UI component library with a wider range of components
- Better documentation and examples for developers
- Larger community and more frequent updates
Cons of iview
- Steeper learning curve due to its extensive feature set
- Potentially larger bundle size when using the entire library
- Less focused on table functionality compared to vue-easytable
Code Comparison
iview table example:
<Table :columns="columns" :data="data">
<template #action="{ row }">
<Button type="primary" size="small" @click="handleEdit(row)">Edit</Button>
<Button type="error" size="small" @click="handleDelete(row)">Delete</Button>
</template>
</Table>
vue-easytable example:
<ve-table
:columns="columns"
:table-data="tableData"
:border-around="true"
:border-x="true"
:border-y="true"
/>
While iview provides a more general-purpose UI library with a wide range of components, vue-easytable focuses specifically on table functionality. iview's table component offers more built-in features and customization options, but vue-easytable provides a simpler API for creating tables with advanced features like virtual scrolling and cell editing. The choice between the two depends on whether you need a comprehensive UI library or a specialized table solution for your Vue.js project.
🌈 An enterprise-class UI components based on Ant Design and Vue. 🐜
Pros of ant-design-vue
- More comprehensive UI component library with a wider range of components
- Better documentation and examples for each component
- Larger community and more frequent updates
Cons of ant-design-vue
- Heavier package size due to the extensive component library
- Steeper learning curve for developers new to the Ant Design ecosystem
- Less flexibility for customization compared to vue-easytable's focused approach
Code Comparison
ant-design-vue:
<template>
<a-table :columns="columns" :data-source="data" />
</template>
<script>
import { Table } from 'ant-design-vue';
</script>
vue-easytable:
<template>
<ve-table :columns="columns" :table-data="tableData" />
</template>
<script>
import { VeTable } from 'vue-easytable';
</script>
Both libraries offer similar syntax for basic table implementation, but ant-design-vue provides more built-in features and styling options out of the box. vue-easytable focuses specifically on table functionality, offering a more lightweight solution for projects that primarily need table components.
Lightweight UI components for Vue.js based on Bulma
Pros of Buefy
- More comprehensive UI component library, offering a wider range of components beyond tables
- Based on Bulma CSS framework, providing a consistent and modern design system
- Larger community and more frequent updates, resulting in better support and maintenance
Cons of Buefy
- Heavier package size due to the inclusion of many components, which may not be ideal for projects only needing table functionality
- Less specialized in table features compared to vue-easytable, which focuses solely on advanced table capabilities
Code Comparison
Buefy table implementation:
<b-table :data="data" :columns="columns">
<template slot-scope="props">
<b-table-column field="name" label="Name">{{ props.row.name }}</b-table-column>
<b-table-column field="age" label="Age">{{ props.row.age }}</b-table-column>
</template>
</b-table>
vue-easytable implementation:
<ve-table :columns="columns" :table-data="tableData">
<template v-slot:name="{ row }">{{ row.name }}</template>
<template v-slot:age="{ row }">{{ row.age }}</template>
</ve-table>
Both libraries offer similar table functionality, but Buefy provides a more extensive set of UI components beyond tables, while vue-easytable specializes in advanced table features.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
vue-easytable
English | ä¸æ
Sponsors
Support this project by becoming a sponsor. Your logo or name will show up here with a link you provided. Become a sponsor
Gold Sponsor
Silver Sponsor
Generous Sponsor
Introduction
A powerful data table based on vue2.x You can use it as data gridãMicrosoft Excel or Google sheets. It supports virtual scrollãcell edit etc.
Characteristics
- Support 300000 rows of data display through virtual scroll
- Free forever. Of course, you can also choose to donate
API & Examples
Features
Base components
Table component
- Internationalization
- Theme Custom & Built in theme
- Virtual Scroll
- Column Fixed
- Column Hidden
- Header Fixed
- Header Grouping
- Filter
- Sort
- Column Resize
- Cell Style
- Cell Custom
- Cell Span
- Cell Selection(keyboard operation)
- Cell Autofill
- Cell Edit
- Clipboard
- Contextmenu
- Cell Ellipsis
- Row Radio
- Row Checkbox
- Row Expand
- Row Style
- Footer Summary
- Event Custom
- More
If there is no feature you want, Please Tell Us
Install
npm install vue-easytable
or
yarn add vue-easytable
Usage
Write the following in main.js:
import Vue from "vue";
import "vue-easytable/libs/theme-default/index.css";
import VueEasytable from "vue-easytable";
Vue.use(VueEasytable);
new Vue({
el: "#app",
render: (h) => h(App),
});
Example:
<template>
<ve-table :columns="columns" :table-data="tableData" />
</template>
<script>
export default {
data() {
return {
columns: [
{ field: "name", key: "a", title: "Name", align: "center" },
{ field: "date", key: "b", title: "Date", align: "left" },
{ field: "hobby", key: "c", title: "Hobby", align: "right" },
{ field: "address", key: "d", title: "Address" },
],
tableData: [
{
name: "John",
date: "1900-05-20",
hobby: "coding and coding repeat",
address: "No.1 Century Avenue, Shanghai",
},
{
name: "Dickerson",
date: "1910-06-20",
hobby: "coding and coding repeat",
address: "No.1 Century Avenue, Beijing",
},
{
name: "Larsen",
date: "2000-07-20",
hobby: "coding and coding repeat",
address: "No.1 Century Avenue, Chongqing",
},
{
name: "Geneva",
date: "2010-08-20",
hobby: "coding and coding repeat",
address: "No.1 Century Avenue, Xiamen",
},
{
name: "Jami",
date: "2020-09-20",
hobby: "coding and coding repeat",
address: "No.1 Century Avenue, Shenzhen",
},
],
};
},
};
</script>
Todo List
Environment Support
- Modern browser and ie11 and above
IE / Edge | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|
IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
How to contribute
If you want to contribute,just create a Pull Request
Contributors
Thanks to the following friends for their contributions ð
Discussion group
License
Top Related Projects
:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin
A Vue.js 2.0 UI Toolkit for Web
🐉 Vue Component Framework
A high quality UI Toolkit built on Vue.js 2.0
🌈 An enterprise-class UI components based on Ant Design and Vue. 🐜
Lightweight UI components for Vue.js based on Bulma
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot