ElemeFE / ElemeFE/element

[Feature Request] 合并行或列 合并多列

Open
#20,246 1 comment 0 reactions 0 assignees View on GitHub
stale
Dominant language
Vue
Stars
54k
Forks
14.4k
PR merge metrics
No merged PRs in 30d

Description

### Existing Component

### Component Name
https://element.eleme.cn/2.0/#/zh-CN/component/table

### Description
```
objectSpanMethod({row, column, rowIndex, columnIndex}) {
if (columnIndex >0 && columnIndex <= 3) {
if (!this.crud.data[rowIndex]){
//1列 1行
return {
rowspan: 1,
colspan: 1
};
}
// console.log(this.crud.data[rowIndex].contractNo);
if(this.crud.data[rowIndex - 1] && this.crud.data[rowIndex].contractNo === this.crud.data[rowIndex - 1].contractNo) {
if (this.crud.data[rowIndex][column.property] === this.crud.data[rowIndex - 1][column.property]) {
//0列 0 行
return {
rowspan: 0,
colspan: 0
};
}
}
if(this.crud.data[rowIndex + 1] && this.crud.data[rowIndex].contractNo === this.crud.data[rowIndex + 1].contractNo){
if (this.crud.data[rowIndex][column.property] === this.crud.data[rowIndex + 1][column.property]) {
let conutRowSpan = 1,
countIndex = 1;
var len = this.crud.data.length;
//往下遍历 重复的列有几个 合并几个
for (var i = rowIndex; i <= len; i ++) { //遍历数组
if(this.crud.data[rowIndex + countIndex] && this.crud.data[rowIndex][column.property]=== this.crud.data[rowIndex + countIndex][column.property]){
countIndex +=1;
conutRowSpan +=1;
}else {
break;
}
}
//2列1行
return {
rowspan: conutRowSpan,
colspan: 1
};
}
}
}else {
return {
rowspan: 1,
colspan: 1
};
}
},
```
酱紫 可以合并 多列

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.