Dan*_*aní 1 aurelia aurelia-templating
在 aurelia 中,对于视图,我可以通过实现 getViewStrategy 方法并在 ViewModel 中返回 InlineViewStrategy 来提供内联模板。但这仅适用于视图,不适用于自定义元素。是否有类似的方法为自定义元素提供内联模板?
谢谢
你只需要使用@inlineView装饰器。这是显示这一点的要点:https : //gist.run/? id =1df0554fcfb51fd9ab3d60367bac1b60
import {inlineView} from 'aurelia-framework';
@inlineView('<template>Hello from the inline view</template>')
export class InlineViewCustomElement {
}
Run Code Online (Sandbox Code Playgroud)