我有以下结构。
abstract class AbstractComponent {
public componentWillMount(): void {
this.middlewares.forEach((middleware: MiddlewareInterface) => {
return middleware.applyComponent(this).process();
});
}
}
class Component1 extends AbstractComponent {
protected middlewares: MiddlewareInterface[] = [
PersonUpdateWillMount,
PreventPageLeave
];
// I DON'T WANT THIS TO BE POSSIBLE
public componentWillMount() {
}
}
每当我将componentWillMount
添加到主类时,它都会覆盖抽象类的功能。
我能以某种方式禁用componentWillMount
吗?