当前位置:网站首页>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,
}
}
},
边栏推荐
- Solution to the black screen of win computer screenshot
- 部署api_automation_test过程中遇到的问题
- Distributed transactions: the final consistency scheme of reliable messages
- FE - 微信小程序 - 蓝牙 BLE 开发调研与使用
- Redis——大Key问题
- Win电脑截图黑屏解决办法
- There is no way to drag the win10 desktop icon (you can select it, open it, delete it, create it, etc., but you can't drag it)
- Usage of map and foreach in JS
- Redis——缓存击穿、穿透、雪崩
- PgSQL learning notes
猜你喜欢
随机推荐
Summary of advertisement business bug replay
20201025 Visual Studio2019 QT5.14 信号和槽功能的使用
Vscode installation, latex environment, parameter configuration, common problem solving
Unexpected inconsistency caused by abnormal power failure; Run fsck manually problem resolved
eslint配置代码自动格式化
Idea announced a new default UI, which is too refreshing (including the application link)
Kali latest update Guide
Warp shuffle in CUDA
重载全局和成员new/delete
AtCoder Beginner Contest 253 F - Operations on a Matrix // 树状数组
Tensorrt command line program
Latex 编译报错 I found no \bibstyle & \bibdata & \citation command
Latex参考文献引用失败 报错 LaTeX Warning: Citation “*****” on page y undefined on input line *
实现strStr() II
日志 - 7 - 记录一次丢失文件(A4纸)的重大失误
NodeJs - Express 中间件修改 Header: TypeError [ERR_INVALID_CHAR]: Invalid character in header content
Vector types and variables built in CUDA
Win10: add or delete boot items, and add user-defined boot files to boot items
Functions of tensorrt
Fe - weex uses a simple encapsulated data loading plug-in as the global loading method








