当前位置:网站首页>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,
}
}
},
边栏推荐
- Loops in tensorrt
- ModuleNotFoundError: No module named ‘jieba. analyse‘; ‘ jieba‘ is not a package
- 蚂蚁集团g6初探
- VSCODE 安装LATEX环境,参数配置,常见问题解决
- Flask migrate cannot detect db String() equal length change
- ModuleNotFoundError: No module named ‘jieba.analyse‘; ‘jieba‘ is not a package
- FE - 微信小程序 - 蓝牙 BLE 开发调研与使用
- sprintf_ How to use s
- ctf-web之练习赛
- PgSQL学习笔记
猜你喜欢
自学table au
Win10: add or delete boot items, and add user-defined boot files to boot items
unittest. Texttestrunner does not generate TXT test reports
VSCODE 安装LATEX环境,参数配置,常见问题解决
Latex在VSCODE中编译中文,使用中文路径问题解决
Detailed definition of tensorrt data format
Redis——热点key问题
PgSQL学习笔记
Distributed transactions: the final consistency scheme of reliable messages
Win电脑截图黑屏解决办法
随机推荐
压力测试修改解决方案
Warp matrix functions in CUDA
js中map和forEach的用法
js中对于返回Promise对象的语句如何try catch
Eggjs -typeorm 之 TreeEntity 实战
20201002 vs 2019 qt5.14 developed program packaging
Eggjs -typeorm treeenity practice
Redis - hot key issues
20210306转载如何使TextEdit有背景图片
Automation - when Jenkins pipline executes the nodejs command, it prompts node: command not found
Uploading attachments using Win32 in Web Automation
Sublime Text 配置php编译环境
蚂蚁集团g6初探
How to try catch statements that return promise objects in JS
Log (common log framework)
Unexpected inconsistency caused by abnormal power failure; Run fsck manually problem resolved
[literature reading and thought notes 13] unprocessing images for learned raw denoising
如何调试微信内置浏览器应用(企业号、公众号、订阅号)
DeprecationWarning: .ix is deprecated. Please use.loc for label based indexing or.iloc for positi
FE - Eggjs 结合 Typeorm 出现连接不了数据库