我的组件具有动态部分和 compose。动态部分在其他模块中,即节点项目。
如果我想在页面中使用自定义元素,例如:
<my-custom-element body.bind="someVariableContainingThePath"></my-custom-element>
我收到一条错误消息,指出无法在 ./my-custom-element/someVariableContainingThePath 中找到在 someVariableContainingThePath 中指定的 View 模型。
在使用 compose 元素时推荐的路径处理方式是什么。
我正在使用 webpack。
有没有办法给模块起别名。
所以可以设置someVariableContainingThePath='moduleA'然后指定 那个 moduleA =/some/path/my-body-custom-element ?
最佳答案
对于 webpack 捆绑,你必须给它一个提示。否则您的 View 将不会被捆绑。 您可以在配置 aurelia 时将您的组件添加到 globalResourses http://aurelia.io/docs/fundamentals/app-configuration-and-startup#making-resources-global
您必须使用 PLATFORM.modulename
装饰您的模块名称,如 .globalResources(PLATFORM.modulename('my-module'))
关于path - Aurelia 构成 View 模型路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39079174/