zoukankan      html  css  js  c++  java
  • element 根据某多个属性合并列

    
    
    
    日常渲染


    
    
    
    
    methods: {
        arraySpanMethod({ row, column, rowIndex, columnIndex }) {
          // 没办法循环判断具体是那一列 所以就只好写了多个if
          if (column.property === "a1")
            return this.mergeAction("a1", rowIndex, column);
          if (column.property === "a2")
            return this.mergeAction("a2", rowIndex, column);
          if (column.property === "a7")
            return this.mergeAction("a7", rowIndex, column);
          if (column.property === "a8")
            return this.mergeAction("a8", rowIndex, column);
          if (column.property === "a9")
            return this.mergeAction("a9", rowIndex, column);
        },
    
        mergeAction(val, rowIndex, colData) {
          let _row = this.rowMergeArrs[val].rowArr[rowIndex];
          let _col = _row > 0 ? 1 : 0;
          return [_row, _col];
        },
    
        rowMergeHandle(arr, data) {
          if (!Array.isArray(arr) && !arr.length) return false;
          if (!Array.isArray(data) && !data.length) return false;
          let needMerge = {};
          arr.forEach(i => {
            needMerge[i] = {
              rowArr: [],
              rowMergeNum: 0
            };
            data.forEach((item, index) => {
              if (index === 0) {
                needMerge[i].rowArr.push(1);
                needMerge[i].rowMergeNum = 0;
              } else {
                if (item[i] === data[index - 1][i]) {
                  needMerge[i].rowArr[needMerge[i].rowMergeNum] += 1;
                  needMerge[i].rowArr.push(0);
                } else {
                  needMerge[i].rowArr.push(1);
                  needMerge[i].rowMergeNum = index;
                }
              }
            });
          });
          return needMerge;
        },
      },

  • 相关阅读:
    AngularJs练习Demo3
    AngularJs练习Demo2
    AngularJs练习Demo1
    上传图片预览,支持IE6
    上传图片预览插件(转)
    微信公众平台SDK
    C# 4.0 并行计算部分
    在没有安装有mvc3的主机上部署asp.net mvc3网站,需要包含的DLL文件
    全排列
    不重复排列
  • 原文地址:https://www.cnblogs.com/chen-yi-yi/p/11250934.html
Copyright © 2011-2022 走看看