rowSpan(key) {
let arr = this.data
.reduce((result, item) => {
if (result.indexOf(item[key]) < 0) {
result.push(item[key])
}
return result
}, [])
.reduce((result, keys) => {
const children = this.data.filter((item) => {
if (item[key] === keys) {
return item
}
})
result = result.concat(
children.map((item, index) => ({
...item,
[`${key}RowSpan`]: index === 0 ? children.length : 0,
}))
)
return result
}, [])
this.data = arr
},
rowSpan(table)
最新推荐文章于 2024-05-30 16:49:10 发布