• element ui 表格合并方法


    // 合并
        objectSpanMethod({ row, column, rowIndex, columnIndex }) {
          let $rowIndex = rowIndex;
          let fields = ["rectificationNo"]; //需要合并的字段
          let cellValue = row[column.property];
          let data = this.tableData; // 表格的所有数据,
          if (cellValue && fields.includes(column.property)) {
            let prevRow = data[$rowIndex - 1];
            let nextRow = data[$rowIndex + 1];
            if (prevRow && prevRow[column.property] === cellValue) {
              return { rowspan: 0, colspan: 0 };
            } else {
              let countRowspan = 1;
              while (nextRow && nextRow[column.property] === cellValue) {
                nextRow = data[++countRowspan + $rowIndex];
              }
              if (countRowspan > 1) {
                return { rowspan: countRowspan, colspan: 1 };
              }
            }
          }
        },

      在el-table 表格上添加:span-method="objectSpanMethod"

  • 相关阅读:
    一个通用的事件监听函数全集
    单应性矩阵
    opencv姿态估计
    opencv相机标定
    Harris角点
    盒滤波Box Filter
    win10+vs2015+pcl1.8.1安装配置
    图像元素遍历
    阈值分割
    二叉树的层次遍历
  • 原文地址:https://www.cnblogs.com/cyf-1314/p/14918026.html
Copyright © 2020-2023  润新知