@bindable
デコレーターを使用して、Aurelia カスタム要素に属性を渡すことができます。
export class ItemCustomElement {
@bindable model: Item;
}
<item model.bind="model"></item>
データを渡すメソッドが必要なドキュメントによると、レンダリングされたカスタム要素の<compose>
扱いが異なるのはなぜですか? 尊重されません。activate
@bindable
export class ItemCustomElement {
@bindable model: Item;
activate(model: Item): void {
this.model = model;
}
}
<compose view-model="./item" model.bind="model"></compose>
カスタム要素の観点からは、現在、それがどのように使用されるか、<compose>
または使用されないかを知る必要があります。カスタム要素は、この外部の決定から分離する必要があると思います。@bindable
どちらの場合でも機能しますか?