我在 TypeScript 应用程序中使用 Tabulator 版本 5.5.4,并打算开发一个自定义模块。我正在按照Tabulator文档中概述的步骤进行操作。但是,我在自定义模块创建过程中遇到了错误,下面提供了具体的错误消息。
自定义模块.ts
import * as Tabulator from "tabulator-tables";
class CustomModule extends Tabulator.Module{
constructor(table){
super(table);
//register table options
//register column options
//register table functions
//register component functions
}
initialize(){
//subscribe to internal events
//register data handlers
}
}
CustomModule.moduleName = "custom";
表.ts
import * as Tabulator from "tabulator-tables";
Tabulator.Tabulator.registerModule(CustomModule );
环境配置:
更好的做法是从库中显式导入您需要的功能,这样树摇动将通过仅导入使用功能来改善代码大小
import {Module} as Tabulator from "tabulator-tables";
class CustomModule extends Module{
import {Tabulator} as Tabulator from "tabulator-tables";
Tabulator.registerModule(CustomModule);