element ui官网table组件里面有合并的例子你可以做参考去写
官网的实例代码在这里:https://element.eleme.cn/#/zh-CN/component/table#he-bing-xing-huo-lie
arraySpanMethod({ rowIndex, columnIndex }) {
if (rowIndex === 0) { // rowIndex是行(——)的意思,比如我只想合并第一个数据行
if (columnIndex === 0) { // columnIndex是列(|)的意思,比如我现在合并第1列到第3列
return [1, 3]
} else if (columnIndex < 3) { // 列合并终止后返回[0,0]是正常不合并的意思
return [0, 0]
}
}
}
就是使用arraySpanMethod这个api来合并的,用法看我的解释,以下是效果图