您参考以下代码再试试看能否实现您的需求:
- window.onload = function () {
- let designerConfig = JSON.parse(
- JSON.stringify(GC.Spread.Sheets.Designer.DefaultConfig)
- );
- let designer = new GC.Spread.Sheets.Designer.Designer(
- "gc-designer-container",
- designerConfig
- );
- let spread = designer.getWorkbook();
- let sheet = spread.getActiveSheet();
- let oldOpenMenu = spread.contextMenu.onOpenMenu;
- spread.contextMenu.onOpenMenu = function (
- menuData,
- itemsDataForShown,
- hitInfo,
- spread
- ) {
- oldOpenMenu.apply(this, arguments);
- console.log(itemsDataForShown);
- for (const element of itemsDataForShown) {
- const item = element;
- if (item.name == "sheetTag") {
- itemsDataForShown.splice(9, 1);
- }
- }
- };
- };
复制代码 |