Code Monkey home page Code Monkey logo

vxe-table's Introduction

vxe-table

简体中文 | 繁體中文 | English

star npm version npm build npm downloads issues issues closed pull requests pull requests closed npm license

一个基于 vue 的 PC 端表单/表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、JSON 配置式...

  • 设计理念

    • 面向现代浏览器,高效的简洁 API 设计
    • 模块化表格、按需加载
    • 为单行编辑表格而设计,支持增删改查及更多扩展,强大的功能的同时兼具性能
  • 计划

    • v1.0 基于 vue2.6,支持所有主流的浏览器,实现表格的一切实用的功能
    • v2.0 基于 vue2.6,支持所有主流的浏览器,同时兼具功能与性能
    • v3.0 基于 vue2.6,支持现代浏览器并保留兼容 IE11
    • v4.0 基于 vue3.x,只支持现代浏览器,不支持 IE
    • 下一阶段:sticky 渲染模式、将虚拟滚动提升到极致、虚拟滚动动态行高、数据图表可视化

浏览器支持

Edge Chrome Firefox Opera Safari
80+ ✔ 80+ ✔ 90+ ✔ 75+ ✔ 10+ ✔

功能点

  • 基础表格
  • 配置式表格
  • 基础表单
  • 配置式表单
  • 斑马线条纹
  • 多种边框
  • 单元格样式
  • 列宽拖动
  • 最小/最大高度
  • 自适应宽高
  • 固定列
  • 多级表头
  • 表尾数据
  • 高亮行或列
  • 序号
  • 单选框
  • 复选框
  • 下拉选项
  • 开关
  • 排序
  • 多字段排序
  • 筛选
  • 合并单元格
  • 合并表尾
  • 导入/导出/打印
  • 显示/隐藏列
  • 加载中
  • 格式化内容
  • 自定义插槽 - 模板
  • 快捷菜单
  • 展开行
  • 分页
  • 工具栏
  • 下拉容器
  • 虚拟列表
  • 虚拟树
  • 增删改查
  • 数据校验
  • 数据代理
  • 键盘导航
  • 弹窗
  • 渲染器
  • 虚拟滚动
  • 虚拟合并
  • CSS 变量主题
  • (插件) 单元格区域选取
  • (插件) 单元格复制/粘贴
  • (插件) 单元格查找和替换

安装

版本:vue 3.x

npm install vxe-table@next

Get on unpkg and cdnjs

npm

import { createApp } from 'vue'
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'

createApp(App).use(VXETable).mount('#app')

CDN

使用第三方 CDN 方式记得锁定版本号,避免受到非兼容性更新的影响
不建议将第三方的 CDN 地址用于正式环境,因为该连接随时都可能会失效

<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/vxe-table@next/lib/style.css">
<!-- 引入脚本 -->
<script src="https://unpkg.com/xe-utils"></script>
<script src="https://unpkg.com/vxe-table@next"></script>

示例

<template>
  <div>
    <vxe-table :data="tableData">
      <vxe-column type="seq" title="Seq" width="60"></vxe-column>
      <vxe-column field="name" title="Name"></vxe-column>
      <vxe-column field="role" title="Role"></vxe-column>
      <vxe-colgroup title="Group1">
        <vxe-column field="sex" title="Sex"></vxe-column>
        <vxe-column field="address" title="Address"></vxe-column>
      </vxe-colgroup>
    </vxe-table>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'

const tableData = ref([
  { id: 10001, name: 'Test1', role: 'Develop', sex: 'Man', address: 'Shenzhen' },
  { id: 10002, name: 'Test2', role: 'Test', sex: 'Man', address: 'Guangzhou' },
  { id: 10003, name: 'Test3', role: 'PM', sex: 'Man', address: 'Shanghai' }
])
</script>

在线文档

👉 官网文档

参与文档完善、补充详细文档

💡 官网文档源码

QQ 交流群

该群供大家交流問題,如果群人数已满,将会不定期剔除不活跃的。

qq qq

运行项目

安装依赖

npm run update

启动本地调试

npm run serve

编译打包,生成编译后的目录:es,lib

npm run lib

License

MIT © 2019-present, Xu Liangzhan

vxe-table's People

Contributors

botheyes1993 avatar cdzengqinglong avatar estebanfuentealba avatar fcyao avatar jieme avatar john60676 avatar k983551019 avatar leemove avatar lucio-c avatar lzhd avatar majinju avatar maxmeng93 avatar pany-ang avatar phantasweng avatar sakahiro avatar simploo avatar suboy avatar titans1001 avatar wangdaodao avatar wdpimenta avatar wekersnail avatar xlz26296 avatar xuliangzhan avatar zouyujie avatar zqy233 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vxe-table's Issues

API中的某些方法貌似没有

描述 Describe
vxe-table api 中的getAllRecords(),getSelectRecords()不可用
electron 下使用

请提供能重现问题的链接(jsfiddle、jsrun) Expected behavior

请填写以下版本信息 please complete the following information

  • 浏览器版本: electron: 2.0.4
  • vue: 2.5.16
  • vxe-table: 0.7.3

可以提供手动触发cellClassName执行的方法吗

image
异步滚动分页加载数据后,发现只有第一页被标色了,后面的页的数据没有。但是通过日志,看到后面页数据渲染时候,cellclassname方法的标色的代码有被执行,实际上却没标上色

怎么只在引入js文件的情况下,使用Elementui渲染?

描述 Describe
不使用webpack打包,只在单文件中引入vxe-table的情况下,怎么实现elementui渲染?

请提供能重现问题的链接(jsfiddle、jsrun) Expected behavior

请填写以下版本信息 please complete the following information

  • vue: ?
  • vxe-table: ?

column的id 有bug,在下一个路由里面会递增

column的id 有bug,在下一个路由里面会递增,在本页面只刷新数据也会一直递增,不会重置,只有刷新正个页面,id从会从0再开始递增,可以提供一个重置column的id的方法吗?
image
下一步的页面id 起步就是103了,沿着上一个页面递增的。

使用<keep-alive>后,再动态组件里面有空白

在keep-alive里面的vxe-table,滚动到其他位置再切换回来,是空白。如图(因子集是一个表格),先垂直滚动vxe-table到一定的位置,然后切换其他的tab,再点回来,vxe-table显示的空白,
微信截图_20190521211901
`


`

删除行导致选中异常

问题描述 Describe the bug
表格拓展功能删除行,当选中两行时,调用删除行后,再去选择数据,select-change时间返回的数据还包含已删除的数据

重现问题的步骤 To Reproduce

请提供能重现问题的链接(jsfiddle、jsrun) Expected behavior

报错信息或截图 Error message or screenshots

期望的结果 Expected behavior

请填写以下版本信息 please complete the following information

  • vue: ?
  • vxe-table: ?

列可视化渲染时候,拿不到真实的columnIndex,拿到的是可视区的index

vxe-table 0.9.3

更新最新版本0.9.14后,数据都出不来了,又撤回到0.9.3了

实际上已经102了
image

image

作者大大帮忙看看

22

选中210X3-5、210X3-6 ,横向拖动滚动条时候,选中的项不断的往后移动,因为headerCellClassName 函数里面的回调columnIndex 不是真实的数据index,到最后210X14-6被选中了。。

使用vxe-table-plugin-element渲染ElAutocomplete无效

描述 Describe
看了下vxe-table-plugin-element的文档,说是支持ElAutocomplete,结果没有渲染出来,也不清楚问题出在了哪,而且还没有报错

请提供能重现问题的链接(jsfiddle、jsrun) Expected behavior

image
image

Edit表格-数据校验row, 数据校验不通过, 鼠标移开后, 不通过的数据也保存了.

问题描述 Describe the bug
场景: 比如我点击编辑按钮, 激活了row的可编辑状态, 其中有一列是带非空校验的, 但是我不填写内容, 鼠标一挪开input, 空的内容也保存了,.

重现问题的步骤 To Reproduce

请提供能重现问题的链接(jsfiddle、jsrun) Expected behavior

报错信息或截图 Error message or screenshots
image
image

期望的结果 Expected behavior

请填写以下版本信息 please complete the following information

  • 浏览器版本: 谷歌浏览器 版本 74.0.3729.169(正式版本) (32 位)?
  • vue: 2.6.6?
  • vxe-table: 0.9.02?

数据验证没有提示信息

描述 Describe
数据验证没有提示信息,验证失败了只是一个红框,没有message的提示
验证失败也不会像示例代码一样左上角有红色小箭头

问题重现
https://codepen.io/ahmczsy/pen/JQoMGX

请填写以下版本信息 please complete the following information

  • 浏览器版本: chrome 75
  • vue: 2.6.10
  • vxe-table: 1.0.1

table中自定义模板要怎么拿到index下标值呢!麻烦了

描述 Describe
如果提供信息不详细的作者可能不会答复及解决!

请提供能重现问题的链接(jsfiddle、jsrun) Expected behavior

请填写以下版本信息 please complete the following information

  • 浏览器版本: ?
  • vue: ?
  • vxe-table: ?

vxe-grid添加的toolbar工具栏样式显示不出来

生成toolbar的代码不一样,

刷新新增新增并激活标记/取消删除选中移除保存导出.csv
而例子上生成的代码:
刷新新增新增并激活标记/取消删除选中移除保存导出.csv
是哪里出问题呢?

column prop为某些值时输入框不可编辑

问题描述 Describe the bug
vxe-table-column的prop参数位某些字符串时,其下的可编辑输入框不可编辑

<vxe-table-column
            label="描述"
            min-width="240"
            prop="price"
            :edit-render="{name: 'ElInput'}"
            >
            <template v-slot:edit="{ row }">
              <el-input v-model="row.remark"></el-input>
            </template>
            <template v-slot="{ row }">{{row.remark}}</template>
</vxe-table-column>
const item = {
  baseUnit: '',
  code: '',
  componentId: '',
  componentSpec: '',
  count: 0,
  id: '',
  materialSpecifications: '',
  materielCode: '',
  materielId: '',
  materielName: '',
  modelId: '',
  name: '',
  price: 0,
  reasonId: [],
  reasonName: '',
  remark: '',
  supplemenorderId: '',
  unit: ''
}

prop为remark时输入框不可编辑,为price时可编辑
重现问题的步骤 To Reproduce

请提供能重现问题的链接(jsfiddle、jsrun) Expected behavior

报错信息或截图 Error message or screenshots

期望的结果 Expected behavior

请填写以下版本信息 please complete the following information

  • 浏览器版本: ?
  • vue: ?
  • vxe-table: ?

使用element集成后,select选择框和日期选择框无法选择

使用element集成后,select选择框和日期选择框无法选择

<template>
  <div style="width: 1000px; margin: 0 auto">
    <vxe-table
      border
      show-all-overflow
      show-footer
      class="vxe-table-element"
      height="400"
      :loading="loading"
      :data.sync="tableData"
      :edit-config="{key: 'id', trigger: 'click', mode: 'cell', showIcon: false}"
    >
      <vxe-table-column
        prop="name"
        label="ElInput"
        min-width="140"
        align="center"
        header-align="center"
        :edit-render="{type: 'default'}"
      >
        <template v-slot:edit="{ row }">
          <el-input size="small" v-model="row.name"></el-input>
        </template>
      </vxe-table-column>
      <vxe-table-column
        prop="age"
        label="ElInputNumber"
        width="160"
        :edit-render="{type: 'default'}"
      >
        <template v-slot:edit="{ row }">
          <el-input-number size="small" v-model="row.age"></el-input-number>
        </template>
      </vxe-table-column>
      <vxe-table-column prop="sex" label="ElSelect" width="140" :edit-render="{type: 'default'}">
        <template v-slot:edit="{ row }">
          <el-select v-model="row.sex" @change="change">
            <el-option
              v-for="item in sexList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </template>
        <template v-slot="{ row }">{{ getSelectLabel(row.sex, sexList) }}</template>
      </vxe-table-column>
      <vxe-table-column prop="date" label="ElDatePicker" width="200" :edit-render="{type: 'default'}">
        <template v-slot:edit="{ row }">
          <el-date-picker v-model="row.date" type="date" format="yyyy/MM/dd"></el-date-picker>
        </template>
        <template v-slot="{ row }">{{ formatDate(row.date, 'yyyy/MM/dd') }}</template>
      </vxe-table-column>
    </vxe-table>
  </div>
</template>
<script>
import XEUtils from "xe-utils";
export default {
  name: "about",
  data() {
    return {
      loading: false,
      tableData: [],
      sexList: [{ label: "男", value: '0' }, { label: "女", value: '1' }],
      regionList: []
    };
  },
  created() {
    this.loading = true;
    setTimeout(() => {
      let list = window.MOCK_DATA_LIST.slice(0, 5);
      this.tableData = list;
      this.loading = false;
    }, 500);
  },
  methods: {
    change(val) {
      console.log(val) // 这里选择不上
    },
    footerMethod({ columns, data }) {
      return [
        columns.map((column, columnIndex) => {
          if (columnIndex === 0) {
            return "平均";
          }
          if (["age", "rate"].includes(column.property)) {
            return XEUtils.mean(data, column.property);
          }
          return "-";
        }),
        columns.map((column, columnIndex) => {
          if (columnIndex === 0) {
            return "和值";
          }
          if (["age", "rate"].includes(column.property)) {
            return XEUtils.sum(data, column.property);
          }
          return "-";
        })
      ];
    },
    getSelectLabel (value, list, valueProp = 'value', labelProp = 'label') {
      let item = XEUtils.find(list, item => item[valueProp] === value)
      return item ? item[labelProp] : null
    },
    formatDate (value, format) {
      return XEUtils.toDateString(value, format)
    },
  }
};
</script>

请填写以下版本信息 please complete the following information

  • 浏览器版本: chrome 74.0.3729.131
  • vue: "vue": "^2.6.10",
  • vxe-table: "vxe-table": "^0.9.10",

Please, add english translation

这个新特性和一个问题相关吗?简单描述下,比如我什么场景下,需要解决什么问题,发现表格不支持这个功能 Is your feature request related to a problem? Please describe.

描述下,你希望得到的什么解决方案 Describe the solution you'd like

是否有不错的替代方案 Describe alternatives you've considered

更新到最新版本后,大数据表格渲染出不来了

vxe 0.9.14
看文档里面都是使用的vxe-grid的方式

我使用的是和之前版本差不多的vxe-table的方式,<0.9.3版本的是可以的,大于这个版本的,数据渲染不出来。一样的代码之前版本可以渲染出表格,新版本就不行。
image
image
image

element ui 自定义模板插槽的值报undefined

问题描述 Describe the bug

重现问题的步骤 To Reproduce

请提供能重现问题的链接(jsfiddle、jsrun) Expected behavior

报错信息或截图 Error message or screenshots

期望的结果 Expected behavior

请填写以下版本信息 please complete the following information

  • 浏览器版本: ?
  • vue: ?
  • vxe-table: ?

增加动态定义列的分组

这个新特性和一个问题相关吗?简单描述下,比如我什么场景下,需要解决什么问题,发现表格不支持这个功能 Is your feature request related to a problem? Please describe.
需要在动态列名下生成列的分组,不用的报表列头分组不同,所以需要动态渲染,之前自己在vue-element-extends下自定义组件实现的,现在是否可以在vxe-table中增加这个功能

描述下,你希望得到的什么解决方案 Describe the solution you'd like
是否考虑增加动态定义列的分组,目前只能动态定义列,但是不能定义列的分组,是否可以增加group的属性[{ prop:‘group1', label:'分组1' }]这种模式来实现。

是否有不错的替代方案 Describe alternatives you've considered

表格设置selection时,需要禁用某一行进行选中

这个新特性和一个问题相关吗?简单描述下,比如我什么场景下,需要解决什么问题,发现表格不支持这个功能 Is your feature request related to a problem? Please describe.

描述下,你希望得到的什么解决方案 Describe the solution you'd like
在表格列为选择列时候,需要禁止选择当前行选中操作,是否有相关参数属性?
全选的时候禁止某一行选中的列,不在选中的范围内。

是否有不错的替代方案 Describe alternatives you've considered

自定义模板插槽的值报undefined

描述 Describe

请提供能重现问题的链接(jsfiddle、jsrun) Expected behavior

请填写以下版本信息 please complete the following information

  • 浏览器版本: ?
  • vue: ?
  • vxe-table: ?

多表头尾行合计显示错乱

问题描述 Describe the bug
多表头尾行合计显示错乱,看了下尾行合计代码,rowspan取的都是表头所占的行数

重现问题的步骤 To Reproduce

请提供能重现问题的链接(jsfiddle、jsrun) Expected behavior

报错信息或截图 Error message or screenshots

期望的结果 Expected behavior

请填写以下版本信息 please complete the following information

  • 浏览器版本: ?
  • vue: ?
  • vxe-table: ?

edit-config的key如何正确设置

描述 Describe
edit-config的key设置为vxe-table-column的prop是没问题的,但是我不想让key这一列显示
edit-config的key属性可以设置为data.sync数据的某一个属性吗?

数据较多是,表格展示错误

之前遇到过一个证券公司需求是同时支持10000条数据(不能分页)的表格的需求,尝试了一下你的表格,我载入1W条数据的时候,只能展示前面70条,不知道怎么回事。

vxe grid的分页控件更新版本有问题了吧?

问题描述 Describe the bug

重现问题的步骤 To Reproduce

请提供能重现问题的链接(jsfiddle、jsrun) Expected behavior

报错信息或截图 Error message or screenshots

期望的结果 Expected behavior

请填写以下版本信息 please complete the following information

  • 浏览器版本: ?
  • vue: ?
  • vxe-table: ?

最新版本0.2.8 引入报错

描述 Describe

index.common.js:10728 Uncaught TypeError: plugin is not a function at index.common.js:10728 at Array.map (<anonymous>) at Object.install (index.common.js:10727) at Function.Vue.use (vue.runtime.esm.js:5101) at Module../src/main.js (main.js:23) at __webpack_require__ (bootstrap:791) at fn (bootstrap:149) at Object.1 (main.js:158613) at __webpack_require__ (bootstrap:791) at checkDeferredModules (bootstrap:45)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.