Aurelia破坏组件名称不起作用

时间:2017-07-07 09:03:44

标签: javascript aurelia aurelia-binding aurelia-cli aurelia-framework

我有一个基本的Aurelia组件,看起来当我在它的名字中使用破折号时,它不起作用。

当我这样做时它会起作用:

import {inject, customElement, bindable} from 'aurelia-framework';

@customElement('helloworld')
@inject(Element)
export class HelloWorldCustomElement {
    constructor(element) {
        console.log ('here')
    }
}
<helloworld></helloworld>

但它不是这样的时候:

import {inject, customElement, bindable} from 'aurelia-framework';

@customElement('hello-world')
@inject(Element)
export class HelloWorldCustomElement {
    constructor(element) {
        console.log ('here')
    }
}
<hello-world></hello-world>

根据Aurelia的文档,它应该是双向的:https://github.com/aurelia/templating/blob/master/doc/article/en-US/templating-custom-elements.md

1 个答案:

答案 0 :(得分:1)

我设法找到了原因。在app.html中,我有以下行,似乎存在命名冲突。删除它可以立即解决问题。

<require from="hello-world/hello-world.html"></require>
相关问题