table,设置 数据相同时, 合并列

复制代码
  <el-table :data="tableData" :span-method="objectSpanMethod" border style="width: 100%" show-summary>
        <el-table-column type="index" label="序号" width="100" />
        <el-table-column prop="date" label="日期" width="100"></el-table-column>
<el-table>

data(){
	return{
	    mergeArr: ['date'] // 表格中的列名, 可多个字段
	}
}

      objectSpanMethod({ row, column, rowIndex, columnIndex }) {
        //判断列的属性
        if (this.mergeArr.indexOf(column.property) !== -1) {
          // 判断其值是不是为0 
          if (this.mergeObj[column.property][rowIndex]) {
            return [this.mergeObj[column.property][rowIndex], 1]
          } else {
            // 如果为0则为需要合并的行
            return [0, 0];
          }
        }
        }
相关推荐
倔强的石头10642 分钟前
openGauss数据库:从CentOS 7.9部署到实战验证
linux·数据库·centos
4***14903 小时前
MySQL调试技巧与工具
数据库·mysql
Arva .3 小时前
如何监控并优化慢 SQL?
数据库·sql
w***4245 小时前
【MySQL】复合查询
数据库·mysql
q***01776 小时前
【MySQL】表的基本操作
数据库·mysql·oracle
budingxiaomoli6 小时前
存储过程和触发器
数据库
q***12536 小时前
PostgreSQL_安装部署
数据库·postgresql
q***48256 小时前
mysql用户名怎么看
数据库·mysql
夏日玲子6 小时前
【Redis】Redis常用命令合集
数据库·redis·缓存
万邦科技Lafite7 小时前
1688图片搜索商品API接口(item_search_img)使用指南
java·前端·数据库·开放api·电商开放平台