我正在研究aurealia中的自定义成分,并出现了一些我不理解的奇怪行为。考虑到这一点:
组件: xxxaaa.html
<template>
<div>xxxxxx</div>
</template>xxxaaa.js:
export class Xxxaaa {}app.html:
<template>
<import from='./xxxaaa'></import>
<div>
<xxxaaa/>
</div>
</template>如预期的那样,xxxxxx将显示。然后,camelcaseing组件:
xxxAaa.html:内容没有更改,只有文件名
xxxAaa.js:
export class XxxAaa {}app.html:
<template>
<import from='./xxxAaa'></import>
<div>
<xxxAaa/>
</div>
</template>没有显示任何内容,但日志不包含任何错误,只有:
启动了index.js:26调试模板,为dist/app.html "dist/xxxAaa“导入index.js:26调试模板,为dist/xxAaa.html导入资源[]
因此,第一个问题是,为何会这样?
更新:在我看来,这要么是aurelia中的bug (它没有正确报告错误定制的elt),要么是我对它实际工作方式的理解上的重大差距。你能不能确认一下这是个bug,或者解释一下为什么奥雷利亚会默默地忽略我的元素。
然后,回滚回第一个工作状态,并在将xxxaaa.js更改为
export class xxxaaa {}控制台日志错误:
Potentially unhandled rejection [1] TypeError: Cannot call a class as a function
at execute._classCallCheck (http://localhost:9090/dist/xxxaaa.js:9:108)
at xxxaaa (http://localhost:9090/dist/xxxaaa.js:12:9)
at Container.invoke (http://localhost:9090/jspm_packages/github/aurelia/dependency-injection@0.4.5/container.js:362:27)
at Array.<anonymous> (http://localhost:9090/jspm_packages/github/aurelia/dependency-injection@0.4.5/container.js:142:52)
at Container.get [as superGet] (http://localhost:9090/jspm_packages/github/aurelia/dependency-injection@0.4.5/container.js:238:32)
at Container.elementContainerGet [as get] (http://localhost:9090/jspm_packages/github/aurelia/templating@0.8.14/view-factory.js:27:17)
at CustomElement.create (http://localhost:9090/jspm_packages/github/aurelia/templating@0.8.14/custom-element.js:136:80)
at applyInstructions (http://localhost:9090/jspm_packages/github/aurelia/templating@0.8.14/view-factory.js:79:33)
at ViewFactory.create (http://localhost:9090/jspm_packages/github/aurelia/templating@0.8.14/view-factory.js:172:17)
at CustomElement.create (http://localhost:9090/jspm_packages/github/aurelia/templating@0.8.14/custom-element.js:141:58)因此,第二个问题--是什么导致了这个案件的敏感性?是es6,巴贝尔还是奥雷利亚?
更新:我希望在这里,aurelia会抱怨它找不到类,但是看起来它捡到了错误的类并尝试使用它。异常本身是相当模糊的(https://github.com/babel/babel/issues/887,https://github.com/babel/babel/issues/700),但是我是否正确地理解它是来自aurelia的错误报告错误的情况呢?
https://stackoverflow.com/questions/28963599
复制相似问题