当前位置:网站首页>The table component specifies the concatenation parallel method
The table component specifies the concatenation parallel method
2022-07-02 06:46:00 【The health of the bright moon in Qin Dynasty】
majority table Component only provides an abstract method to merge rows or columns , for example element ui Components ,
The parameter interpretation and usage of this method are as follows ,
I can see you ,rowspan Represents the number of rows actually occupied by each row of data ,colspan Represents the number of columns actually occupied by each row of data , We can encapsulate the following methods based on raw data ,
export const getSpanMethodData = (data = [], columns = [ ]) => {
let mergeColumns = {
} // Used to remember the index of data and the number of repetitions when merging columns
let pos = {
} // It is used to record every repetition of the columns that need to be merged , Number of repetitions
columns.forEach(p => {
mergeColumns[p] = []
pos[p] = 0
})
for (let i = 0; i < data.length; i++) {
if (i === 0) {
columns.forEach(p => {
mergeColumns[p].push(1)
pos[p] = 0
})
} else {
columns.forEach((p, index) => {
let obj = {
curr: '',
prev: '',
}
for (let j = 0; j <= index; j++) {
obj.curr += JSON.stringify(data[i][columns[j]])
obj.prev += JSON.stringify(data[i - 1][columns[j]])
}
if (obj.curr === obj.prev) {
mergeColumns[p][pos[p]] += 1
mergeColumns[p].push(0)
} else {
mergeColumns[p].push(1)
pos[p] = i
}
})
}
}
return mergeColumns
}
When executed span-method Method time , You can write like this ,
handleSpan ({
row, column, rowIndex, columnIndex, }) {
if (columnIndex === 0) {
const _row = this.table.spanArr[column.key][rowIndex]
const _col = _row > 0 ? 1 : 0
return {
rowspan: _row,
colspan: _col,
}
}
},
边栏推荐
- 20201002 VS 2019 QT5.14 开发的程序打包
- Record RDS troubleshooting once -- RDS capacity increases dramatically
- After reading useful blogs
- Latex在VSCODE中编译中文,使用中文路径问题解决
- (the 100th blog) written at the end of the second year of doctor's degree -20200818
- qq邮箱接收不到jenkins构建后使用email extension 发送的邮件(timestamp 或 auth.......)
- sprintf_ How to use s
- Sublime Text 配置php编译环境
- Latex 编译报错 I found no \bibstyle & \bibdata & \citation command
- unittest. Texttestrunner does not generate TXT test reports
猜你喜欢

The default Google browser cannot open the link (clicking the hyperlink does not respond)

No process runs when querying GPU, but the video memory is occupied

Self study table Au

Latex 编译报错 I found no \bibstyle & \bibdata & \citation command

Pytest (2) mark function

PgSQL学习笔记

20201002 vs 2019 qt5.14 developed program packaging

实现strStr() II

Thread hierarchy in CUDA

Build learning tensorflow
随机推荐
构建学习tensorflow
自学table au
Name six schemes to realize delayed messages at one go
Code skills - Controller Parameter annotation @requestparam
查询GPU时无进程运行,但是显存却被占用了
(第一百篇BLOG)写于博士二年级结束-20200818
看完有用的blog
How to try catch statements that return promise objects in JS
Dynamic global memory allocation and operation in CUDA
Kotlin - verify whether the time format is yyyy MM DD hh:mm:ss
Redis - grande question clé
Shardingsphere JDBC
Warp matrix functions in CUDA
PgSQL学习笔记
Log (common log framework)
2020-9-23 QT的定时器Qtimer类的使用。
web自动化切换窗口时报错“list“ object is not callable
The default Google browser cannot open the link (clicking the hyperlink does not respond)
AWD learning
日志 - 7 - 记录一次丢失文件(A4纸)的重大失误