在使用@children装饰器时,我收到以下警告:
vendor-bundle.js:14294 WARN [property-observation] Cannot observe property 'columns' of object我的自定义元素代码是:
@children('data-grid-column') column= [];
我正在尝试将它绑定到这个视图模型,这样我就可以获得一个包含列数据的对象数组:
import {bindable, noView} from 'aurelia-templating';
@noView
export class DataGridColumn {
@bindable name;
@bindable display;
@bindable align;
}它工作得很好,但错误似乎表明出了什么问题。我不需要在这里观察属性,但我想知道为什么我会得到这个错误。
<data-grid data.bind="records">
<data-grid-column name="acc_code" display="Code"></data-grid-column>
<data-grid-column name="acc_name_orig" display="Account"></data-grid-column>
</data-grid>发布于 2017-02-07 11:05:35
这似乎是一个已知的问题,已经解决了。我认为这个警告将在下一个aurelia-templating版本中消失。请参阅https://github.com/aurelia/templating/issues/520
现在,如果你在类级别使用@children,就不会发生这种情况。
@children({ name: "columns", selector: "column" })
export class DataGridColumn {
//...
}https://stackoverflow.com/questions/42074880
复制相似问题