diff --git a/docs/zh/guide/config.md b/docs/zh/guide/config.md index 90704b6..5e48a6f 100644 --- a/docs/zh/guide/config.md +++ b/docs/zh/guide/config.md @@ -1348,7 +1348,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有 ------------ ### sheetDeleteBefore -(TODO) + - 类型:Function - 默认值:null - 作用:sheet删除前 @@ -1357,7 +1357,7 @@ Luckysheet开放了更细致的自定义配置选项,分别有 ------------ ### sheetDeleteAfter -(TODO) + - 类型:Function - 默认值:null - 作用:sheet删除后 diff --git a/src/controllers/sheetmanage.js b/src/controllers/sheetmanage.js index ec070c2..f8ee432 100644 --- a/src/controllers/sheetmanage.js +++ b/src/controllers/sheetmanage.js @@ -586,6 +586,14 @@ const sheetmanage = { } let arrIndex = _this.getSheetIndex(index); + + const file = Store.luckysheetfile[currentIdx]; + + // 钩子 sheetDeleteBefore + if(!method.createHookFunction('sheetDeleteBefore', { sheet: file })){ + return; + } + _this.setSheetHide(index); $("#luckysheet-sheets-item" + index).remove(); @@ -600,6 +608,8 @@ const sheetmanage = { removedsheet[0].type = "deleteSheet"; Store.jfredo.push(removedsheet[0]); } + // 钩子 sheetDeleteAfter + method.createHookFunction('sheetDeleteAfter', { sheet: file }); }, nulldata: null, getGridData: function(d) {