angular6继承类注意几点:

1:写成这样

export class aextends bimplements OnInit {

}

2:在引入服务依赖的时候写成这样

constructor(public technicalProductsService: TechnicalProductsService) {
    super(technicalProductsService);
}

3:b类的属性在a类重新定义的时候应该在a类的constructor函数里面使用this改写

constructor(public technicalProductsService: TechnicalProductsService) {

    super(technicalProductsService);

    this.articleClassify = 4;

  }

猜你喜欢

转载自blog.csdn.net/z15802933724/article/details/82683443