zoukankan      html  css  js  c++  java
  • Vue+element 表格Table合并问题

     
    <el-table
            :data="gridlist"
            :span-method="objectSpanMethod"
            ref="table"
            tooltip-effect="dark"
            border
            stripe
            style=" 100%"
          >
    首先就是在table上添加:span-method="objectSpanMethod"方法
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
          if (columnIndex === 2) {
            if (rowIndex % 5 === 0) {
              return {
                rowspan: 5,
                colspan: 1,
              }
            } else {
              return {
                rowspan: 0,
                colspan: 0,
              }
            }
          }

          if (columnIndex === 8) {
            if (rowIndex % 5 === 0) {
              return {
                rowspan: 3,
                colspan: 1,
              }
            } else if ((rowIndex - 3) % 5 === 0) {
              return {
                rowspan: 2,
                colspan: 1,
              }
            } else {
              return {
                rowspan: 0,
                colspan: 0,
              }
            }
          }
          if (columnIndex === 9 || columnIndex === 10) {
            if (rowIndex % 5 === 0) {
              return {
                rowspan: 5,
                colspan: 1,
              }
            } else {
              return {
                rowspan: 0,
                colspan: 0,
              }
            }
          }
          if (columnIndex === 11) {
            if (rowIndex === 0) {
              return {
                rowspan: this.gridlist.length,
                colspan: 1,
              }
            } else {
              return {
                rowspan: 0,
                colspan: 0,
              }
            }
          }
        },
    效果图就是这样
  • 相关阅读:
    mysql 状态查看
    Float浮点内存存储方式 转
    printf("%d",5.01)和printf("%f",5)的输出结果
    RMBP
    小D课堂【SpringBoot】接口Http协议开发实战
    尚硅谷【SpringBoot】web(源码讲解太多不建议阅读)
    尚硅谷【SpringBoot】入门
    51cto-spring boot(一Spring4快速入门)
    Eclipse使用Maven时出现:Index downloads are disabled, search results may be incomplete.问题解决
    maven(二)
  • 原文地址:https://www.cnblogs.com/fkxx/p/15439238.html
Copyright © 2011-2022 走看看