这是我的代码
复现步骤:ctrl+单击,然后点右键删除的时候会执行好多次
let undoManager = spread.undoManager()
let oldUndo = undoManager.undo
let undoFlag = false
undoManager.undo = function() {
undoFlag = true
return oldUndo.apply(this, arguments)
}
sheet.bind(GC.Spread.Sheets.Events.RowChanging, function(e, info) {
let count = info.count
let sheet = info.sheet
let rowDataArray = []
if (info.propertyName == 'deleteRows' && !undoFlag) {
let selections = sheet.getSelections()
if (selections && selections.length > 0) {
let sel = selections[0]
let result = sheet.getArray(sel.row, 0, sel.rowCount, sheet.getColumnCount())
result.forEach((item, index) => {
let num = /^[0-9]+.?[0-9]*$/
if (num.test) {
let id = item.pop()
rowDataArray.push(id)
}
})
}
console.log(rowDataArray, 'rowDataArray')
}
})
sheet.bind(GC.Spread.Sheets.Events.RowChanged, function(e, info) {
if (info.isUndo) {
// 标记undo结束
undoFlag = false
}
}) |