Intact
Intact copied to clipboard
Should freeze the property passed to component
When we pass a Object to child component, the child component may change the property of that Object. But the $change event can not to be triggered.
class A extends Intact {
defauts() {
return {data: {}};
},
change() {
// this set will trigger '$change:data.a' and '$change:data' events
this.set('data.a', 1);
}
}
// when the users has changed by `change` method of A component
// we can not get the `$change:user.a` and `$change:user` events
<A data={self.get('user')} />
So we should freeze the property which passed to child component.