在插入空白行的时候,如果是在画好的表格下插入,api提供的插入空白行会插入没有任何格式的一行,无法匹配合并了单元格的表格格式,需要手动编写api
1.找到api.js,在src/global中,新增一个方法
export function copyRow(sourceIndex, targetIndex) {let sourceData = JSON.parse(JSON.stringify(Store.flowdata[sourceIndex]))let targetData = []for (let i in sourceData) {let data = nulllet row = sourceData[i]if (row != null) {if (row.mc != null) {data = {}data.mc = row.mcdata.mc.r = targetIndexStore.config['merge'][data.mc.r + '_' + data.mc.c] = data.mc}}targetData.push(data)}Store.flowdata[targetIndex] = JSON.parse(JSON.stringify(targetData))
}
2.在个人项目中的使用步骤为:
window.luckysheet.insertRow(index)
window.luckysheet.copyRow(sourceIndex,targetIndex)