如果我有这样的课程:
common.ts(在 mixins 文件夹下):
export class Common { }
基础组件.ts:
@Mixin([Validation])
export abstract class BaseComponent extends Common implements Validation {...}
基本列表类型组件.ts:
@Injectable()
class BaseListComponent<T, U> extends BaseComponent implements OnInit, OnDestroy {...}
带有模板的组件.component.ts:
@Component({
selector: "app-component-with-template",
templateUrl: "./component-with-template.component.html"
})
export class ComponentWithTemplate extends BaseListComponent<DataInterface, DataService> {...}
在Angular中使用这样的继承是一个好习惯吗?关于性能,使用继承还是创建服务更好?