当前位置:网站首页>Merge the same items in the same column in table
Merge the same items in the same column in table
2022-07-29 05:38:00 【Meow sauce fell asleep】
Realization effect 
Implementation method :
1. Use table The consolidation method provided in spanMethod
spanMethod({
row, column, rowIndex, columnIndex}) {
if (column.property === 'materielName') {
return {
rowspan: this.mergeObj[column.property][rowIndex],
colspan: 1
}
} else {
return {
rowspan: 1, colspan: 1 }
}
},
2. Calculate the number of merged items
getMergeObj (list) {
this.mergeObj = {
}
let mack = 0
for (let key in list[0]) {
this.mergeObj[key] = []
mack = 0
list.forEach((item, index) => {
if (index === 0) {
this.mergeObj[key].push(1)
} else {
if (item[key] === list[index - 1][key] && item[key]) {
this.mergeObj[key][mack] += 1
this.mergeObj[key].push(0)
} else {
mack = index
this.mergeObj[key].push(1)
}
}
})
}
}
}
3. Rendering table Data processing and use getMergeObj Method
this.getMergeObj(this.tableData)
边栏推荐
猜你喜欢

Li Kou 994: rotten orange (BFS)

【电子电路】ADC芯片如何选型

Day 2

【C语言系列】— 一道递归小题目

公众号不支持markdown格式文件编写怎么办?
![Niuke network programming problem - [wy22 Fibonacci series] and [replace spaces] detailed explanation](/img/39/1d4fb1774b0f9f7c9bb13221f0d6c2.png)
Niuke network programming problem - [wy22 Fibonacci series] and [replace spaces] detailed explanation

【JS题解】牛客网JS篇1-10题
![[C language series] - storage of deep anatomical data in memory (II) - floating point type](/img/a4/126d9f8e812d8f69b4249eac837bf6.png)
[C language series] - storage of deep anatomical data in memory (II) - floating point type

Installation steps and environment configuration of vs Code

Selenium实战案例之爬取js加密数据
随机推荐
字符类型转换
Basic concepts of MySQL + database system structure + extended application + basic command learning
uniapp之常用提示弹框
Basic principle of recursion
HCIA-R&S自用笔记(26)PPP
Day 5
抽象类与接口
·来一篇编程之路的自我介绍吧·
第三课threejs全景预览房间案例
【电子电路】ADC芯片如何选型
虚拟增强与现实第二篇 (我是一只火鸟)
[C language series] - realize the exchange of two numbers without creating the third variable
Introduction to C language array to proficiency (array elaboration)
Using POI TL to insert multiple pictures and the same data of multiple rows of cells into the table cells of word template at one time, it is a functional component for automatic merging
[C language series] - string + partial escape character explanation + annotation tips
Topological ordering of a graph of water
微信小程序-组件传参,状态管理
ClickHouse学习(八)物化视图
利用Poi-tl在word模板表格单元格内一次插入多张图片和多行单元格相同数据自动合并的功能组件
href与src的区别