fix: 新建表格的单元格ID重复

This commit is contained in:
pipipi-pikachu 2021-06-09 15:35:06 +08:00
parent 4412af30bb
commit d669404c92

View File

@ -103,8 +103,14 @@ export default () => {
fontname: fontName.value, fontname: fontName.value,
color: fontColor.value, color: fontColor.value,
} }
const rowCells: TableCell[] = new Array(col).fill({ id: createRandomCode(), colspan: 1, rowspan: 1, text: '', style }) const data: TableCell[][] = []
const data: TableCell[][] = new Array(row).fill(rowCells) for (let i = 0; i < row; i++) {
const rowCells: TableCell[] = []
for (let j = 0; j < col; j++) {
rowCells.push({ id: createRandomCode(), colspan: 1, rowspan: 1, text: '', style })
}
data.push(rowCells)
}
const DEFAULT_CELL_WIDTH = 100 const DEFAULT_CELL_WIDTH = 100
const DEFAULT_CELL_HEIGHT = 36 const DEFAULT_CELL_HEIGHT = 36