请问下OnInit 是什么呢? export class ScrollableTabComponent implements OnInit
来源:2-6 【组件封装】分离封装第一个组件

慕虎5224321
2019-09-04
老师,请问下OnInit 是什么呢? export class ScrollableTabComponent implements OnInit
我代码报错: ERROR in src/app/components/scrollable-tab/scrollable-tab.component.ts(21,14): error TS2420: Class ‘ScrollableTabComponent’ incorrectly implements interface ‘OnInit’.
Property ‘ngOnInit’ is missing in type ‘ScrollableTabComponent’ but required in type ‘OnInit’.
网上也没查到 OnInit 是什么
写回答
1回答
-
接灰的电子产品
2019-09-04
是组件的生命周期函数之一。后面会讲的,但你如果实现 OnInit,就需要有 ngOnInit() 函数,你报的错就是没有这个函数;去git中看一下源码就明白了
00
相似问题