element ui table插件的合并列
<el-table :data="mTemList" :span-method="objectSpanMethod" border style="width: 100%; margin-top: 20px"> <el-table-column :prop="item.code" :label="item.name" v-for='item in tarArr' :key='item.code'> </el-table-column> </el-table>
objectSpanMethod({ row, column, rowIndex, columnIndex }) { if (columnIndex === 0 || columnIndex === 1) {选择合并哪一列 if (rowIndex % this.num === 0) {//合并多少行 return { rowspan: this.num, //要合并的行数 colspan: 1 }; } else { return { rowspan: 0, colspan: 0 }; } } }