当前位置:网站首页>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,
}
}
},
边栏推荐
- Redis - grande question clé
- Promise中有resolve和无resolve的代码执行顺序
- Win10网络图标消失,网络图标变成灰色,打开网络设置闪退等问题解决
- automation - Jenkins pipline 执行 nodejs 命令时,提示 node: command not found
- js中map和forEach的用法
- 【文献阅读与想法笔记13】 Unprocessing Images for Learned Raw Denoising
- The default Google browser cannot open the link (clicking the hyperlink does not respond)
- 实现strStr() II
- web自动化切换窗口时报错“list“ object is not callable
- Selenium memo: selenium\webdriver\remote\remote_ connection. Py:374: resourcewarning: unclosed < XXXX > solution
猜你喜欢
随机推荐
kali最新更新指南
selenium+msedgedriver+edge浏览器安装驱动的坑
js中对于返回Promise对象的语句如何try catch
Detailed definition of tensorrt data format
Fe - eggjs combined with typeorm cannot connect to the database
unittest.TextTestRunner不生成txt测试报告
Kali latest update Guide
apt命令报证书错误 Certificate verification failed: The certificate is NOT trusted
Dynamic global memory allocation and operation in CUDA
Deployment API_ automation_ Problems encountered during test
代码技巧——Controller参数注解@RequestParam
Sublime text configuring PHP compilation environment
20210306转载如何使TextEdit有背景图片
JS modification element attribute flipping commonly used in selenium's Web Automation
AWD learning
构建学习tensorflow
Solution to the black screen of win computer screenshot
Pytest (2) mark function
实现strStr() II
Latex warning: citation "*****" on page y undefined on input line*








