Browse Source
Merge pull request #865 from nekobc1998923/fix-add-many-col-error
fix: 修复右键添加多列时,添加出来的cell单元格数据会同步的问题
master
mengshukeji
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
3 deletions
-
src/global/extend.js
|
@ -921,16 +921,18 @@ function luckysheetextendtable(type, index, value, direction, sheetIndex) { |
|
|
let row = d[r]; |
|
|
let row = d[r]; |
|
|
|
|
|
|
|
|
for(let i = 0; i < value; i++){ |
|
|
for(let i = 0; i < value; i++){ |
|
|
|
|
|
// *这里不能是引用,不然添加多列时添加的都是同一个引用,修改一个cell会同步到多个
|
|
|
|
|
|
const COLR = JSON.parse(JSON.stringify(col[r])) |
|
|
if(direction == "lefttop"){ |
|
|
if(direction == "lefttop"){ |
|
|
if(index == 0){ |
|
|
if(index == 0){ |
|
|
row.unshift(col[r]); |
|
|
row.unshift(COLR); |
|
|
} |
|
|
} |
|
|
else{ |
|
|
else{ |
|
|
row.splice(index, 0, col[r]); |
|
|
row.splice(index, 0, COLR); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else{ |
|
|
else{ |
|
|
row.splice((index + 1), 0, col[r]); |
|
|
row.splice((index + 1), 0, COLR); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|