我有 2 个商店,即 AttachmentStore 和 CommentStore。
export class AttachmentStore {
@observable attachments = []
}
export class CommentStore {
@observable comments = []
save_comment_and_attachment(comment, attachments) {
this.comments.push(comment);
//how can I push the attachment to the
//attachments observable
}
}
我知道我可以将附件声明为 CommentStore observables 的一部分,但是有什么方法可以更新从 CommentStore 观察到的附件?