无外部节点的Aurelia自定义元素
是否可以让Aurelia在没有封装组件节点的情况下渲染自定义元素?或者将自定义元素节点替换为其内容 例如: app.html无外部节点的Aurelia自定义元素,aurelia,Aurelia,是否可以让Aurelia在没有封装组件节点的情况下渲染自定义元素?或者将自定义元素节点替换为其内容 例如: app.html <template> <require from = "./components/custom-component.html"></require> <custom-component></custom-component> </template> 自定义组件.html <tem
<template>
<require from = "./components/custom-component.html"></require>
<custom-component></custom-component>
</template>
自定义组件.html
<template>
<p>This is some text from dynamic component...</p>
</template>
这是动态组件中的一些文本
结果
基于此示例:使用aurelia是否可以将组件中的
元素呈现为
的直接子元素,这样就不会有自定义组件
-节点?在组件上使用无容器
属性
例如:
您还可以使用containerless()
decorator装饰自定义组件。
请参阅:请注意,只有在绝对必要时才应使用无容器属性/装饰器。它约束一些自定义元素功能。
<template>
<p>This is some text from dynamic component...</p>
</template>