1

aurelia では、ビューに対して、getViewStrategy メソッドを実装し、ViewModel で InlineViewStrategy を返すだけでインライン テンプレートを提供できます。ただし、これはビューに対してのみ機能し、カスタム要素に対しては機能しません。カスタム要素のインライン テンプレートを提供する同様の方法はありますか?

ありがとう

4

2 に答える 2

5

@inlineViewデコレータを使用するだけです。これを示す要点は次のとおりです。https://gist.run/?id=1df0554fcfb51fd9ab3d60367bac1b60

import {inlineView} from 'aurelia-framework';

@inlineView('<template>Hello from the inline view</template>')
export class InlineViewCustomElement {
}
于 2016-08-26T14:04:19.270 に答える