如主题中所示,prop firstChange 和方法 isFirstChange 之间的区别在哪里?使用 prop 相对于 method (或者 method 相对于 prop)有什么优势吗?两者似乎都返回相同的东西。
没有区别。该isFirstChange()
函数在语义上是访问成员属性的正确方法firstChange
。
从源头来看:
export class SimpleChange {
constructor(public previousValue: any, public currentValue: any, public firstChange: boolean) {}
isFirstChange(): boolean {
return this.firstChange;
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1853 次 |
最近记录: |