Closed cipchk closed 6 years ago
使用 get 属性获取属性:
get
get format() { return this.widgetData.format || 'YYYY-MM-DD'; }
由于 widgetData 是同一个地址这倒置 schema 任意对象的改变可能会引起组件重新渲染。
widgetData
schema
而 nz-sf 在外部 Schema 的改变会重新渲染整个组件树,而其 Schema 在渲染过程中是固定不变,基于此,将所有属性的获取放在 ngOnInit 中,并将其转换成属性值,例如:
nz-sf
ngOnInit
format: string; ngOnInit() { this.format = this.widgetData.format || 'YYYY-MM-DD'; }
此项优化将影响所有小部件。
使用
get
属性获取属性:由于
widgetData
是同一个地址这倒置schema
任意对象的改变可能会引起组件重新渲染。而
nz-sf
在外部 Schema 的改变会重新渲染整个组件树,而其 Schema 在渲染过程中是固定不变,基于此,将所有属性的获取放在ngOnInit
中,并将其转换成属性值,例如:此项优化将影响所有小部件。