mirror of
https://gitee.com/xuliangzhan_admin/vxe-table.git
synced 2026-01-21 05:27:57 +08:00
221 lines
15 KiB
Markdown
221 lines
15 KiB
Markdown
# vxe-table
|
||
|
||
[](https://gitee.com/xuliangzhan_admin/vxe-table/stargazers)
|
||
[](https://www.npmjs.org/package/vxe-table)
|
||
[](https://travis-ci.org/xuliangzhan/vxe-table)
|
||
[](http://npm-stat.com/charts.html?package=vxe-table)
|
||
[](https://unpkg.com/vxe-table/lib/index.min.js)
|
||
[](https://unpkg.com/vxe-table/lib/index.css)
|
||
[](https://github.com/xuliangzhan/vxe-table/issues)
|
||
[](https://github.com/xuliangzhan/vxe-table/issues?q=is%3Aissue+is%3Aclosed)
|
||
[](https://github.com/xuliangzhan/vxe-table/pulls)
|
||
[](https://github.com/xuliangzhan/vxe-table/pulls?q=is%3Apr+is%3Aclosed)
|
||
[](https://github.com/xuliangzhan/vxe-table/blob/master/LICENSE)
|
||
|
||
一个简单实用的 Vue 表组件,与任意组件库兼容
|
||
|
||
* 设计理念
|
||
* 精简的 API(简洁、高效的 API 设计)
|
||
* 模块化表格、插件化扩展(功能模块解耦,支持按需加载)
|
||
* 强大的功能的同时兼具性能(支持横向、纵向虚拟滚动、灵活的配置项、不污染全局样式及变量)
|
||
|
||
* 计划
|
||
* [x] v1 100% 实现表格的一切实用的功能
|
||
* [x] v2 95% 性能优化,同时兼具功能与性能
|
||
* [ ] v3 0% 实现重构,渲染性能大幅提升,基于 Vue3 并使用 typescript 开发
|
||
|
||
🐬 如果有更好的建议、优化点或 Bug 都欢迎提 [Issues](https://github.com/xuliangzhan/vxe-table/issues)
|
||
|
||
## Browser Support
|
||
|
||
 |  |  |  |  | 
|
||
--- | --- | --- | --- | --- | --- |
|
||
11+ ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
|
||
|
||
## Features
|
||
|
||
* [x] Basic table (基础功能)
|
||
* [x] Dynamic Grid (配置式表格)
|
||
* [x] Size (尺寸)
|
||
* [x] Striped (斑马线条纹)
|
||
* [x] Table with border (带边框)
|
||
* [x] Cell style (单元格样式)
|
||
* [x] Column resizable (列宽拖动)
|
||
* [x] Fluid-height table with fixed header (流体高度)
|
||
* [x] Resize height and width (响应式宽高)
|
||
* [x] Table with fixed header (固定表头)
|
||
* [x] Table with fixed column (固定列)
|
||
* [x] Table with fixed columns and header (固定表头和列)
|
||
* [x] Grouping table head (表头分组)
|
||
* [x] Table sequence (序号)
|
||
* [x] Highlight row and column (高亮行、列)
|
||
* [x] Radio (单选)
|
||
* [x] Checkbox (多选)
|
||
* [x] Sorting (排序)
|
||
* [x] Filter (筛选)
|
||
* [x] Rowspan and colspan (合并行或列)
|
||
* [x] Footer summary (表尾合计)
|
||
* [x] Export CSV (导出 CSV)
|
||
* [x] Show/hide columns (显示/隐藏列)
|
||
* [x] Loading (加载中)
|
||
* [x] Format content (格式化内容)
|
||
* [x] Custom column template (自定义模板)
|
||
* [x] Context menu(快捷菜单)
|
||
* [x] Virtual Scroller(虚拟滚动)
|
||
* [x] Expandable row (展开行)
|
||
* [x] Pager(分页)
|
||
* [x] Toolbar(工具栏)
|
||
* [x] Tree table (树形表格)
|
||
* [x] Editable CRUD(增删改查)
|
||
* [x] Editable validate(数据校验)
|
||
* [x] DataProxy(数据代理)
|
||
* [x] Keyboard navigation(键盘导航)
|
||
|
||
## Modules
|
||
|
||
*  (核心)
|
||
* Modules (内置模块)
|
||
*  (表头)
|
||
*  (表主体)
|
||
*  (表尾)
|
||
*  (图标)
|
||
*  (筛选)
|
||
*  (加载中)
|
||
*  (提示信息)
|
||
*  (快捷菜单)
|
||
*  (导出)
|
||
*  (按键导航)
|
||
*  (响应式)
|
||
* Component (增强组件)
|
||
*  (动态表格)
|
||
*  (静态列)
|
||
*  (分页 )
|
||
*  (工具栏)
|
||
*  (复选框)
|
||
*  (单选框)
|
||
*  (输入框)
|
||
*  (模态窗口)
|
||
*  (按钮)
|
||
* Plugins(插件)
|
||
* 增强插件
|
||
* [](https://www.npmjs.org/package/vxe-table-plugin-menus) ([菜单插件](https://www.npmjs.com/package/vxe-table-plugin-menus))
|
||
* [](https://www.npmjs.org/package/vxe-table-plugin-charts) ([图表插件](https://www.npmjs.com/package/vxe-table-plugin-charts))
|
||
* [](https://www.npmjs.org/package/vxe-table-plugin-excel) ([Excel 插件](https://www.npmjs.com/package/vxe-table-plugin-excel))
|
||
* 适配插件
|
||
* [](https://www.npmjs.org/package/vxe-table-plugin-element) ([element-ui 适配插件](https://www.npmjs.com/package/element-ui))
|
||
* [](https://www.npmjs.org/package/vxe-table-plugin-iview) ([iview 适配插件](https://www.npmjs.com/package/iview))
|
||
* [](https://www.npmjs.org/package/vxe-table-plugin-antd) ([ant-design-vue 适配插件](https://www.npmjs.com/package/ant-design-vue))
|
||
|
||
## Docs
|
||
|
||
[To view the user guide 使用指南](https://github.com/xuliangzhan/vxe-table-demo)
|
||
|
||
[To view the example](https://xuliangzhan.github.io/vxe-table/#/table/base/basic) [查看演示](https://xuliangzhan_admin.gitee.io/vxe-table/#/table/base/basic)
|
||
[To view the document](https://xuliangzhan.github.io/vxe-table/#/table/api) [查看文档](https://xuliangzhan_admin.gitee.io/vxe-table/#/table/api)
|
||
|
||
## Installing
|
||
|
||
require: Vue 2.6+
|
||
require: xe-utils 2.2+
|
||
|
||
```shell
|
||
npm install vxe-table
|
||
```
|
||
|
||
Get on [unpkg](https://unpkg.com/vxe-table/) and [cdnjs](https://cdn.jsdelivr.net/npm/vxe-table/)
|
||
|
||
```HTML
|
||
<!-- 引入样式 -->
|
||
<link rel="stylesheet" href="https://unpkg.com/vxe-table/lib/index.css">
|
||
<!-- 引入脚本 -->
|
||
<script src="https://unpkg.com/xe-utils"></script>
|
||
<script src="https://unpkg.com/vxe-table"></script>
|
||
```
|
||
|
||
```javascript
|
||
import Vue from 'vue'
|
||
import 'xe-utils'
|
||
import VXETable from 'vxe-table'
|
||
import 'vxe-table/lib/index.css'
|
||
|
||
Vue.use(VXETable)
|
||
```
|
||
|
||
## Internationalization
|
||
|
||
```shell
|
||
npm install vxe-i18n
|
||
```
|
||
|
||
```javascript
|
||
import Vue from 'vue'
|
||
import VueI18n from 'vxe-i18n'
|
||
import VXETable from 'vxe-table'
|
||
import zhCNLocat from 'vxe-table/lib/locale/lang/zh_CN'
|
||
import enLocat from 'vxe-table/lib/locale/lang/en'
|
||
|
||
const messages = {
|
||
zh_CN: {
|
||
...zhCNLocat
|
||
},
|
||
en: {
|
||
...enLocat
|
||
}
|
||
}
|
||
|
||
const i18n = new VueI18n({
|
||
locale: 'zh_CN',
|
||
messages,
|
||
})
|
||
|
||
Vue.use(VXETable, {
|
||
i18n: (key, value) => i18n.t(key, value)
|
||
})
|
||
|
||
new Vue({ i18n }).$mount('#app')
|
||
```
|
||
|
||
## Example
|
||
|
||
```html
|
||
<template>
|
||
<div>
|
||
<vxe-table :data="tableData">
|
||
<vxe-table-column type="index" title="序号" width="80"></vxe-table-column>
|
||
<vxe-table-column field="name" title="名字"></vxe-table-column>
|
||
<vxe-table-column field="sex" title="性别"></vxe-table-column>
|
||
<vxe-table-column field="address" title="地址"></vxe-table-column>
|
||
</vxe-table>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data () {
|
||
return {
|
||
tableData: [
|
||
{
|
||
id: 10001,
|
||
name: '名字1',
|
||
role: '角色',
|
||
sex: '男',
|
||
address: '深圳市 圳市 市 xxx'
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
```
|
||
|
||
## Donation
|
||
|
||
If the project is very helpful to you, you can buy the author a cup of coffee.
|
||
如果这个项目对您有帮助,请作者喝杯咖啡吧。☕
|
||
|
||

|
||
|
||
## License
|
||
|
||
MIT License, 2019-present, Xu Liangzhan
|