更新时在子组件中重新绑定数据(AureliaJS)

Rebind data in child component when updates (AureliaJS)

我有一个包含网格子组件的组件。我将数据从父级传递到网格:

<grid data.bind="data"> </grid>

parent更新数据后,child也需要refresh/rebinding。目前还没有。

data是一个对象:

data: {items: myType[], otherData: number}

我怎样才能做到这一点?

提前致谢!

我自己回复,因为问题与 "rebind" 子数据无关。我有一个 class.bind="getClassByStatus(item),其中 item = {status: string, anotherStuff: any} 好吧,实际更新的是 item.status 而不是 item 本身,因此,class.bind 没有观察到 status 属性但是 item,并且 item 没有被更改。

所以,理解 class.bind 的工作原理是我的错。