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,
              }
            }
          }
        },
    效果图就是这样
  • 相关阅读:
    Spring源码情操陶冶-AOP之Advice通知类解析与使用
    Spring源码情操陶冶-AOP之ConfigBeanDefinitionParser解析器
    TCP/IP__Cisco的3层分层模型
    网际互连__冲突域和广播域
    网际互连__数据包结构
    网际互连__散知识点
    网际互连__单播、组播、广播
    网际互连__以太网端口
    网际互连__以太网
    网际互连__TCP/IP三次握手和四次挥手
  • 原文地址:https://www.cnblogs.com/fkxx/p/15439238.html
Copyright © 2011-2022 走看看